1

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?

3

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.