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
Walk from the root: go left if both keys are smaller, right if both are larger, otherwise the current node is the LCA
B
Use BFS over the whole tree
C
Collect both paths and compare all pairs
D
Sort all nodes