Data Structures & AlgorithmsHardProduct-company placement

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

  1. A. 51
  2. B. 52
  3. C. 54
  4. D. 104

Correct answer: B. 52

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

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic