Question DSA-BST-170
HardHow can two BSTs be merged into one balanced BST in O(m + n)?
- A.
Rotate repeatedly
- B.
Join the roots
- C.
Sign up free to see the answer and a step-by-step explanation.
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
Binary Search Trees question
How can two BSTs be merged into one balanced BST in O(m + n)?
Rotate repeatedly
Join the roots
Sign up free to see the answer and a step-by-step explanation.
Insert each node of one into the other
Inorder-traverse both into sorted lists, merge them, and build a balanced tree from the result