0

It is known that O((log n)) is the average timecomplexity for search, insert and deletion for a binary search tree, my question is if this is also the best case? If not what are the best cases?

Cœur
  • 34,719
  • 24
  • 185
  • 251
darrrrUC
  • 311
  • 2
  • 15
  • Possible duplicate of [Search times for binary search tree](http://stackoverflow.com/questions/526718/search-times-for-binary-search-tree) – Bla... Mar 15 '16 at 11:47
  • This might answer your question: http://stackoverflow.com/questions/526718/search-times-for-binary-search-tree – Bla... Mar 15 '16 at 11:48

1 Answers1

1

The best case, as is the case with other data structures, is O(1).

Two examples:

1.)The node that you're searching for is the root and that's the only element in the BST.

2.) In a left/right skewed tree, the node that you want to delete is at the root.

attaboy182
  • 1,959
  • 2
  • 21
  • 26