πŸ“’ Too many exams? Don’t know which one suits you best? Book Your Free Expert πŸ‘‰ call Now!

  • google app store apple app store
  • βœ–

      Question

      In a perfectly balanced Binary Search Tree with N nodes,

      what is the worst-case time complexity for searching for an element?
      A O(1) Correct Answer Incorrect Answer
      B O(log N) Correct Answer Incorrect Answer
      C O(N) Correct Answer Incorrect Answer
      D O(N log N) Correct Answer Incorrect Answer
      E O(NΒ²) Correct Answer Incorrect Answer

      Solution

      In a perfectly balanced BST, the height of the tree is approximately log N. Since search operations traverse a path from the root to a leaf, the worst-case time complexity is proportional to the height, hence O(log N).

      Practice Next
      ask-question