Engrain by ByteRush

DSA.11.02 Mid-levelCore — asked often

Pattern 15: Topological sort

Comes up in: DSA, Frontend system design

This concept is being written. It gets the full five steps — explanation, predict, interview angle, practice with tests, and review cards. Here is exactly what it will cover, so you can study it elsewhere in the meantime.

What it covers

  • Kahn's algorithm (in-degrees) and DFS post-order
  • cycle detection
  • real uses (build systems, module graphs, task schedulers)

Words you will know

topological orderin-degreeDAG

What you will practise

  • course-schedule (M)
  • course-schedule-ii (M)
  • alien-dictionary (H)

Interview questions this answers

  • Explain topological sort and a real frontend use of it.