You are mixing things. There is no "search" involved.
Middle item is a question: "
What is the value of the item that is in the middle?"
What is in the middle?
The array has 3 elements. There is a middle element. Its index is 1 and value 7.
Surprisingly, 3/2 == 1. Is this (array size / 2 is in the middle) true for all arrays?
The array has 6 elements. 6/2==3. Element index 3 has value 7.
Alas, since the array has
even number of elements, the 7 is not exactly middle.
If you were looking for
median, you would say either "6 and 7",
or (6+7)/2.0, i.e. 6.5.
Every array has median.
Binary search is a question:
"
Does the array have value X? If yes, then which item has value X?"
The answer could be any item of the array, or none.
Binary search uses the knowledge that the array is sorted to reduce computation.
You don't have any value to search.