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 06 · DSA · Clinic: search, trees, graphs and heaps · about 14 min to read

Play it as a journeyTutor comes with a plan

Clinic #16: Course Schedule

Pattern: Topological Sort / Cycle Detection · LC 207

Course Schedule
Course Schedule · Open board

Courses ek doosre se teer se jude hain. Teer ka matlab hai “ye course tab tak nahi, jab tak wo poora na ho jaaye”. Agar teer ghoom kar wapas apni hi jagah aa jaaye, koi bhi course kabhi shuru nahi ho sakta.

Before you start. Clinic #15: Number of Islands mein tumne graph traversal dekha tha: nodes, edges, aur unpe BFS/DFS chalana, jahan teer dono taraf jaate the. Yahan wahi traversal hai, bas teer ab sirf ek taraf jaate hain, aur naya sawaal hai: kya in sabko poora karne ka koi order maujood hai?

Lesson 52 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

  • 1962 · Ek project plan jo khud hi phans jaata
  • Course = node, “pehle ye” = ek directed teer
  • Jab A, B ka wait kare aur B, A ka: cycle
  • Kahn ka tareeka: jo ready hai use le lo
  • 0 · Constraints
  • 1 · Solution Ladder, dono O(V+E)
  • 2 · Trace: Kahn, prereq=[[1,0],[2,0],[3,1],[3,2]]
  • 3 · Interview cheat sheet
  • 4 · Chala ke dekho: Kahn, 3-rang DFS, ek naive tareeka, aur ek order ka bug
  • Retrieval

Terms it explains: LC 207, PERT, node, edge, cycle, indegree, topological order, `a` se pehle `b`, directed, Kahn's BFS (indegree), TRUE, rounds, cycle na ho, Course Schedule II.

Review DSA