← Quiz: Topological Sort: all 15 questions
Quiz: Topological Sort · Question 5 of 15
In the course problem, the pair [a, b] means "to take course a, first take course b". Which edge do you add?
In the course problem, the pair [a, b] means "to take course a, first take course b". Which edge do you add?
- A.a → b
- B.b → a
- C.both directions
- D.no edge, just a counter
Answer & explanation
Correct answer: b → a
The prerequisite b must come first, so the edge points from b to a and indeg[a] increases.
Can you get the rest right without peeking?
Take the timed Quiz: Topological Sort quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →