Data Structures & AlgorithmsHardGATE CSE · Graphs
Edges of an undirected weighted graph: A-B 7, A-D 5, B-C 8, B-D 9, B-E 7, C-E 5, D-E 15, D-F 6, E-F 8, E-G 9, F-G 11. What is the weight of its minimum spanning tree?
- A. 37
- B. 41
- C. 43
- D. 39
Correct answer: D. 39
Kruskal accepts A-D 5, C-E 5, D-F 6, A-B 7, B-E 7 and E-G 9 (the rest close cycles): 5 + 5 + 6 + 7 + 7 + 9 = 39.
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
- An undirected graph on vertices 0 to 9 has the edges (0,1), (1,2), (2,0), (3,4), (5,6), (6,7), (7,5) and a self-loop (8,8). How many…
- In a binary tree every node has 0 or 2 children, except 7 nodes that have exactly one child, and there are 12 nodes with two children. How…
- A depth-first search runs on a directed graph with edges A->B, A->C, B->D, C->E, D->E, D->B, E->F, F->C, G->A, G->F, starting from A and…
- Keys 50, 30, 70, 20, 40, 60, 80, 35, 45, 65, 85 are inserted into an empty BST in this order. What is the lowest common ancestor of the…
- The words car, card, care, cat, dog, dot, do are inserted into an initially empty trie. How many nodes does the trie contain, not counting…
- A Fenwick (binary indexed) tree over indices 1 to 16 is used. Updating position 5 touches the nodes 5, 6, 8, 16 (add the lowest set bit…