GATE / CS ARCHIVE

GATE CSE 1994 / QUESTION 1.22

A false graph-search claim

Algorithms · Graph Algorithms · Full GATE CSE 1994 paper

GATE 1994, Q1.22 MCQ
Report issue

Graph Algorithms

Question 1.22, GATE 1994: Which is false: optimal BST via dynamic programming; BFS cannot find connected components; preorder/postorder do not generally uniquely determine a binary tree; DFS can find components?
Tap to enlarge
Your answer
Answer & solution

Answer: B (no official key was published)

Start BFS from an unvisited vertex and mark everything reachable. In an undirected graph this is exactly its connected component. Repeating from remaining unvisited vertices finds every component in O(V+E), disproving B. DFS works similarly. Optimal BST construction has a dynamic-programming formulation. Preorder and postorder alone do not generally distinguish a node’s sole left child from its sole right child, so nonuniqueness is possible. That last statement is a general insufficiency, not a claim that every traversal pair is ambiguous.

Original paper, page 3