Index

Free, with Google

Keep going, free.

A free account opens lessons 2 and 3 of every track, 33 more lessons, and keeps your progress and review cards on every device.

Start free with Google

A chalk plan

Open everything on chalk.

Every lesson, board, video, lab and paper, and the full review decks. Yearly is $39/year.

See plansStart free instead

Module 04 · DSA · DSA, in Hinglish · about 16 min to read

Play it as a journeyTutor comes with a plan

Foundations #09: Graphs

Track: Foundations

Graphs
Graphs · Open board

Kaun kis se juda hai uski list, ek lehar jo layer-by-layer failti hai, ek raasta jo end tak jaake wapas aata hai, aur ek line jo har cheez ko uske sahi order mein nikaal deti hai.

Before you start. Pichhle lesson mein dekha tree bhi ek graph hai, bas usme cycle nahi hoti, ghoom ke wapas usi jagah aane wala raasta (Foundations #08: Trees & Recursion). Queue aur stack jo yahan chalte hain wahi hain jo Foundations #06: Stacks & Queues mein dekhe the, bas ab cycle ho sakti hai, isliye ek nayi cheez chahiye: yaad rakhna kaun dekha ja chuka hai.

Lesson 37 of 96 in DSA

The rest of this lesson is part of a plan.

A plan opens every lesson, board, video, lab and paper on chalk. Yearly is $39/year.

See plansAlready a member? Sign in

Or start free: a free account opens lessons 2 and 3 of every track.

In this lesson

  • 1967: ek chitthi jo khud apna raasta dhoondhti hai
  • Wahi network ka naam: graph
  • Agar sabko ek saath bhejte: lehar jo layer-by-layer failti hai
  • Agar sirf ek lead follow karte: ek raasta jitna door ho sake
  • Wahi chitthi dobara mat bhejo
  • College ka sawaal: kaunsa course pehle
  • List, matrix, ya edge list
  • Tree ka ek-line test
  • BFS: code, aur ek chhupa hua bug
  • visited kab mark karo: enqueue pe ya dequeue pe
  • DFS: code, aur cycle pakadne ka doosra tareeka
  • Topological sort: Kahn’s algorithm, aur teesra case jo interview mein poochte hain

Terms it explains: graph, BFS, DFS, visited set, topological sort, O(V+E), 25,000×, 10 arab cells, dense, Connected, 3,404 ms, 69×, `O(V² + E)`, 49.6 ms, 3× V, Par, rooted, `V − 1`, partial order.

Review DSA