00:01
Marty, for this algorithm, we want to order just the first three numbers in a list of integers.
00:08
So we'll call this algorithm, say, first three.
00:14
Of course, you can call it whatever you'd like.
00:19
And it'll take as input a list of integers, say, an n -size list.
00:29
But in this case, it must be at least three integers in the list.
00:37
Order to be able to order the first three of them.
00:43
All right, so first, you know, and in this case, we're really only concerned with a1, a2, and a3, even though there might be some additional integers.
00:57
And so the first thing we're going to do is check if the first two are in order.
01:03
So we'll say, well, if a1 is greater than a2, so that would be the wrong order.
01:11
Then we want to interchange them, right? so to interchange them, we'll create a temporary, so tmp for a temporary variable.
01:23
So we'll set that equal to a1, and we'll set a1 equal to a 2, and then we will reset a 2 equal to the temporary value, right? so we've just switched their values here.
01:48
And we want to do the same thing for the second and third element in the list...