00:01
Are changing algorithm 3, the binary search algorithm, so that it compares x, what we're searching for, to a sub m at each stage of the algorithm.
00:14
Okay, so whatever in here is simply the algorithm 3 that we are going to be changing, right? so it starts with setting i equal to 1 and j equal to n.
00:24
So it's going to be our first and last end point of our search interval.
00:30
So it starts by setting it equal to the entire interval.
00:34
And then while i is less than j, we're going to go ahead and take roughly the halfway points.
00:44
I have a floor here, and that's so that if the list has an odd number, we can still get a integer point for our location.
00:57
And so we take the floor about roughly halfway, and we check to see if our search value is greater than that.
01:04
The number at the halfway index and if it is then we're going to set our left end point that search interval over so we're going to then next only search the right half of the list and if if it's not greater than that number then we're going to move our right search endpoint to the midway point and then moving forward we'll only be searching the left part of the list okay once we once we get through that loop, we're going to check to see if our search value is equal to the number that's left there.
01:47
And if it is, then we're going to set our location equal to that index...