Question DSA-BST-0003
EasyWhat is the worst-case time complexity of searching an unbalanced BST?
- A.
O(1)
- B.
O(n)
- C.
Show answer and explanation
Answer: B
Inserting sorted data creates a chain (a skewed tree) of height n.
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
Binary Search Trees question
What is the worst-case time complexity of searching an unbalanced BST?
O(1)
O(n)
Answer: B
Inserting sorted data creates a chain (a skewed tree) of height n.
O(log n)
O(n log n)