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 44?
- A. 94, 77, 9, 57, 49, 44
- B. 38, 55, 48, 40, 44
- C. 24, 30, 74, 45, 44
- D. 37, 43, 99, 26, 48, 44
Correct answer: D. 37, 43, 99, 26, 48, 44
Each probe narrows an interval (lo, hi) that must contain 44; every later key must lie strictly inside it. In 37, 43, 99, 26, 48, 44 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 rooted tree has these parent→child edges: 56→8, 64→56, 64→24, 64→45, 24→59, 45→41, 8→2. A depth-first search starts at the root and, at…
- A rooted tree has these parent→child edges: 74→13, 74→24, 84→62, 13→75, 13→66, 24→84. A depth-first search starts at the root and, at…
- A rooted tree has these parent→child edges: 72→45, 31→27, 98→31, 27→38, 31→72, 98→71. A depth-first search starts at the root and, at…
- A rooted tree has these parent→child edges: 74→62, 21→36, 65→79, 62→71, 36→78, 65→76, 71→99, 74→65, 74→21. A depth-first search starts at…
- A rooted tree has these parent→child edges: 78→14, 78→24, 61→26, 96→10, 78→61, 52→78, 14→9, 78→16, 26→96. A depth-first search starts at…
- A rooted tree has these parent→child edges: 39→96, 24→12, 38→88, 88→17, 96→24, 96→74, 39→38, 96→87, 38→26. A depth-first search starts at…