Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Binary tree complexities

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

I can't find complete information. I want to know complexities for the following operations on a binary search tree

  1. to add/insert an element
  2. to remove an element
  3. to find an element (as I know this one is O(log(n)) )
like image 729
nabroyan Avatar asked Dec 03 '22 23:12

nabroyan


1 Answers

Insertion, deletion and searching in a binary search tree are:

  • O(N) in the worst case;
  • O(log(N)) in the average case.
like image 159
md5 Avatar answered Dec 22 '22 00:12

md5