Data Structures & AlgorithmsVery hardGATE CS · ICPC regional · Product Company SDE
How many different spanning trees does the complete graph K7 have (Cayley's formula)?
- A. 21
- B. 16807
- C. 20168
- D. 7776
Correct answer: B. 16807
Cayley: n^(n−2) = 7^5 = 16807.
Practise more Trees, Graphs, Recursion and Dynamic Programming questionsTrees, Graphs, Recursion and Dynamic Programming: notes and key points
More Trees, Graphs, Recursion and Dynamic Programming questions
- Keys 12, 98, 23, 44, 16, 38, 41, 70 are inserted one by one into an empty binary search tree. What is the post-order traversal?
- An undirected graph has edges (u–v: weight) A–B:16, B–C:7, C–D:13, A–E:1, C–F:25, A–C:12, B–F:22, E–D:4. What is the weight of its minimum…
- In the undirected graph with edges A–B:2, A–C:3, A–D:5, C–E:3, E–F:8, F–A:2, what is the shortest-path distance from A to B?
- An undirected graph has adjacency lists A:BCDF B:AC C:AB D:AE E:D F:A. Neighbours are always explored in alphabetical order. Which is the…
- Keys 37, 18, 57, 76, 72, 36, 64, 21 are inserted in this order into an empty BST. What is the height of the tree (edges on the longest…
- A max-heap is built by inserting 61, 86, 95, 83, 45, 47, 46 one by one. After a single extract-max (move last element to root, sift-down)…