Binary search is much more efficient than linear search, with two caveats: (1) The list must already be sorted for binary search to work.
(2) For very short lists it's harder to say which algorithm is faster.
For this problem, you will quantify the performance difference
between the two. For this example, make the following assumptions:
1. We have an unsorted list of 256 items.
2. Sorting the list costs 4480 time units.
3. Each loop iteration of a linear search costs 1 time unit.
4. Each loop iteration of a binary search costs 4 time units.
If you only want to do one search in the list, it's clearly not worth sorting the list then running binary search, because the cost of
sorting is far higher than the cost of a single linear search.
How many searches for items that are not in the list would you have to do to make sorting and using binary search a better strategy than using linear search?
Also write down a few sentences to explain how you calculated your answer. Do not write any code!!!!