Data Structures & AlgorithmsHardGATE CS · Product-company placement
Kruskal's algorithm runs on the weighted undirected graph A–C (29), A–F (19), A–G (2), B–D (8), B–G (25), C–G (14), D–F (1), E–F (11), E–G (27), F–G (7). Which edge is accepted FOURTH, and what is the MST weight?
- A. E–F, weight 43
- B. B–D, weight 43
- C. B–D, weight 48
- D. F–G, weight 43
Correct answer: B. B–D, weight 43
Edges are taken in increasing weight, skipping any that closes a cycle (rejected: A–F, B–G, E–G…); the accepted edges in order are D–F, A–G, F–G, B–D, E–F, C–G, total 43.
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
- How many structurally different binary trees with 5 nodes have height EXACTLY 3 (height = edges on the longest root-to-leaf path)?
- A BST holds integer keys between 1 and 100. Which sequence CANNOT be the sequence of keys examined while searching for 45?
- Bellman–Ford runs from A on the directed graph whose edges are relaxed in EVERY pass in this fixed order: E→B (2), E→C (9), D→F (-3), F→A…
- The POSTORDER traversal of a BST with distinct keys is 11, 32, 67, 77, 91, 95, 94, 92, 80, 52. What are the height of the tree (edges on…
- The POSTORDER traversal of a BST with distinct keys is 16, 27, 31, 56, 95, 79, 58, 51, 45, 32. What are the height of the tree (edges on…
- A tree on vertices 1–11 has edges 2–1, 3–2, 4–3, 5–2, 6–3, 7–5, 8–7, 9–6, 10–9, 11–9. What is the size of a maximum independent set (no…