Data Structures & AlgorithmsHardProduct-company placement

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

  1. A. 18
  2. B. 17
  3. C. 20
  4. D. 36

Correct answer: A. 18

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): 18 orderings in total.

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic