Can anyone explain the difference between binary search and binary search tree with example?Are they the same?Reading the internet it seems the second is only for trees and binary search does not follow this rule.And how to check the presence of a number in O(log(n)) time?
Asked
Active
Viewed 289 times
1
-
Possible duplicate - https://stackoverflow.com/questions/6380231/difference-between-binary-tree-and-binary-search-tree?rq=1 – stud3nt Nov 30 '19 at 12:15
-
3Does this answer your question? [Difference between binary tree and binary search tree](https://stackoverflow.com/questions/6380231/difference-between-binary-tree-and-binary-search-tree) – stud3nt Nov 30 '19 at 12:16
-
Don't confuse yourself.Binary search is a searching algorithm. However BST is a tree data structure which provides efficient searching. – Nawnit Sen Nov 30 '19 at 14:39
1 Answers
1
Binary search is an algorithm used on straightforward sorted arrays, which runs in O(log n). Updating a sorted array is O(n).
A binary tree is a data structure that has both O(log n) search and update (Ignoring problems of balancing).
An interesting comparison is at the end of this chapter.

Ari Fordsham
- 2,437
- 7
- 28