Practice
Learn
← Quit
0 / 0 correct
Data Structures
Hard
1 of 20
How do you find the lowest common ancestor of two nodes in a BST in O(h)?
A
Collect both paths and compare all pairs
B
Sort all nodes
C
Walk from the root: go left if both keys are smaller, right if both are larger, otherwise the current node is the LCA
D
Use BFS over the whole tree