The following SO url provides some good real-world examples for Big O notation:
What does O(log n) mean exactly?
I'm specifically interested in the following example provided for a binary search:
"O(log n): Given a person's name, find the phone number by picking a random point about halfway through the part of the book you haven't searched yet, then checking to see whether the person's name is at that point. Then repeat the process about halfway through the part of the book where the person's name lies. (This is a binary search for a person's name.)"
There are a few things about this that I'm unclear about:
Does a textbook binary search start by searching at the exact halfway point of an array? If there is an even number of items in the array, should a textbook binary search algorithm pick the lower or higher item at random?
Does a textbook binary search do a halfway search on specific data points or does it search on clustered groups of datapoints for better efficiency? Or does a binary search pattern support either one of these approaches?
Can binary search be applied to either sorted or unsorted arrays? Or is it always recommended to programmatically sort an array before executing a binary search?