What is the time complexity of inserting an element into a balanced binary search tree?

  • O(1)
  • O(log n)
  • O(n log n)
  • O(n)
The time complexity of inserting an element into a balanced binary search tree (BST) is O(log n), where n is the number of nodes in the BST. In a balanced BST, each insertion or search operation reduces the search space by half, leading to logarithmic time complexity.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *