In a binary search tree (BST), what is the time complexity of searching an element in the worst case for a skewed tree?

23 views
  • O(1)
  • O(log n)
  • O(n) (Correct Answer)
  • O(n log n)

Explanation

In a skewed BST (all nodes on one side), searching requires visiting each node sequentially, leading to a worst-case time complexity of O(n), unlike a balanced BST which is O(log n).

Comments (0)

No comments yet. Be the first to comment!

Want to practice more?

Explore thousands of MCQs across every exam category on Exams Nepal.

Find More MCQs