00:01
So they want us to use the tournament sort to figure out how many comparisons we would need to find the second third all the way up to the n minus first largest element.
00:13
So we already found in the previous problem that it would take or how many it would take to get our first one.
00:23
So we don't need to really talk about that.
00:25
So let's just talk about like second third and so on.
00:27
So remember, we're assuming that n is in the form of 2 to the k for some value of k.
00:35
So let's just kind of go through some values of k and see what we get.
00:39
So let's say, well, if k is equal to 1, so it actually doesn't give us anything interesting.
00:43
So let's do 2.
00:45
So i'm just going to list 1, 2, 3 up to 4.
00:48
So we compare these elements right there for our tournament sort.
00:55
That one should be 4.
00:57
And then we compare those and that gives us 4.
00:59
So that was just finding our largest, but now let's assume that we get rid of that, replace this with negative infinity, and we want to find our second largest.
01:12
All right, well, let's see how many this would give us.
01:15
Well, we really don't need to compare three in negative infinity.
01:17
We already know that one will go up, but now we need to compare two and three.
01:22
So that would give us three up top.
01:25
So this would only really be one comparison.
01:28
Well, let's figure out what our third should be.
01:32
Well for here remember we're going to get rid of all of the threes so that's negative infinity so in this case we don't need to compare negative infinity negative infinity we just know that this blue negative infinity would get to move up you would have that then we would just compare two and negative infinity well two is going to win so again we only had one comparison there all right now what about when k is equal to three.
02:06
So maybe i should be writing that n would be equal to eight and then over here n is equal to four.
02:12
So let's just write one to eight really quickly.
02:14
So one, two, three, four, six, seven, eight.
02:19
So doing this tournament sort, so that gives us two, four, six, and eight.
02:25
Then we compare these two.
02:26
So that's four versus eight...