The answer is yes. Binary search assumes that you sort your set first. If I am not mistaken, any search algorithm with performance other than O (N) required that your set be stored in some special data structure (sorted list, binary tree, red-black tree ...).
When you implement a binary search for a set, you must make sure that the set, if sorted first. Usually you sort the list first, and then always add the items to the right place (to make sure the new collection is still sorted). Assuming you also use binary search to find the right place to add, both append and search are O (log2 (N)) in the worst case.
When you consider various search algorithms, you should also consider the structure of the underlying data and the cost of adding an element to it.
source share