Question 9
Back to Exercise
Keys 1, 2, 3, …, n are inserted in that order into an unbalanced binary search tree. What is the cost of a search afterwards?
- A O(1)
- B O(log n)
- C O(n) Correct
- D O(n log n)
Correct Answer: Option C
Every key goes to the right of the previous one, so the tree degenerates into a chain of height n.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!