Data Structures & AlgorithmsHardGATE CS · Product-company placement
A BST holds integer keys between 1 and 100. Which sequence CANNOT be the sequence of keys examined while searching for 50?
- A. 47, 73, 46, 51, 50
- B. 39, 44, 45, 46, 53, 50
- C. 13, 90, 28, 52, 32, 50
- D. 70, 11, 33, 57, 50
Correct answer: A. 47, 73, 46, 51, 50
Each probe narrows an interval (lo, hi) that must contain 50; every later key must lie strictly inside it. In 47, 73, 46, 51, 50 one key falls outside the interval already fixed by an earlier ancestor.
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
- A directed graph on A–H has edges A→G, A→H, B→D, B→E, B→H, F→A, F→D, F→E, G→B, H→C, H→D. How many strongly connected components does it…
- Symbols occur with frequencies 7, 19, 20, 25, 26, 39. How many bits does an optimal (Huffman) prefix code need for the whole message, and…
- A rod of length 8 can be cut into integer pieces; a piece of length i sells for p(i) with p(1..8) = 2, 4, 15, 18, 19, 23, 24, 29. What is…
- What is the maximum flow from S to T in the network with directed capacities A→C (13), A→T (8), B→C (10), B→T (10), C→T (3), S→B (4), S→C…
- Keys 66, 49, 54, 41, 65, 58, 22, 18, 42, 47 are inserted into an empty AVL tree (giving preorder 54, 41, 22, 18, 47, 42, 49, 65, 58, 66)…
- An undirected connected graph has edges A–D, A–F, A–G, B–C, B–F, B–H, B–I, C–D, C–H, D–F, E–I. How many articulation points (cut vertices)…