What would be the time complexity of inserting an element in a balanced Binary Search Tree?

  • O(1)
  • O(log n)
  • O(n log n)
  • O(n)
In a balanced Binary Search Tree (BST), inserting an element takes O(log n) time on average. This is because the tree's balanced structure ensures that you traverse down the tree logarithmically with respect to the number of nodes.
Add your answer
Loading...

Leave a comment

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