Data Structures & AlgorithmsHardProduct-company placement

How many topological orderings does the DAG on vertices A–F with edges C→A, C→B, C→E, F→B, F→C, F→D have?

  1. A. 29
  2. B. 32
  3. C. 30
  4. D. 60

Correct answer: C. 30

Count by placing vertices one at a time, each time choosing any vertex whose predecessors are all placed (or DP over subsets of placed vertices): 30 orderings in total.

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic