Binary tree complexity

I would like to know some of the complexities of the binary search tree.

I can not find the full information. I want to know the difficulties for the following operations in a binary search tree

  • add / insert element
  • delete item
  • to find an element (as I know it is O(log(n)) )
+4
source share
3 answers

Insert, delete, and search in the binary search tree:

  • O(N) in the worst case;
  • O(log(N)) in the middle case.
+10
source

If you have a balanced binary tree, all three difficulties will be O(log(N)) . If you are not balancing the tree, it could be O(N) .

+7
source

Search is effective. But an unbalanced structure (which often happens) can lead to O (N) for search / insert / delete operations. This is why binary heap or other balanced trees are preferred with O (log n). .

0
source

All Articles