Computer Science EngineeringHardISRO SC (CS)
A DAG has vertices 1..6 and edges 1->2, 2->6, 3->4, 4->5. The number of distinct topological orderings is:
- A. 21
- B. 20
- C. 19
- D. 40
Correct answer: B. 20
Count linear extensions by DP over subsets of already-placed vertices: 20.
Practise more Algorithms, Data Structures & Programming (ISRO CS) questionsAlgorithms, Data Structures & Programming (ISRO CS): notes and key points
More Algorithms, Data Structures & Programming (ISRO CS) questions
- How many structurally distinct binary trees (left and right children distinguished) with exactly 5 nodes have height exactly 3 edges?
- Job sequencing with deadlines (each job takes 1 unit; profit earned only if finished by its deadline). Jobs as (deadline, profit): (3,22)…
- Consider the following C fragment. int c=0; for(int i=1;i<=40;i=2) for(int j=1;j<=i;j++) c++; What is c at the end?
- The length of a longest common subsequence of DAAAADDCBB and CBCCDCBBA is:
- Using the Master theorem (extended form), the solution of T(n) = 4T(n/2) + n log^2 n is:
- The keys [40, 18, 25, 51, 17, 19] are inserted in this order into an initially empty AVL tree. The height of the final tree, counted in…