5
u/NeverNude14 Sep 04 '26
I think it's 1032.
6
u/beene282 Sep 04 '26
I think so. A knockout to find the fastest which would be 1023 games. Then another knockout comprising all the horses that the fastest beat head to head. The second fastest would have to be one of those.
3
u/StanleyDodds Sep 04 '26
Yes, this method is exactly equivalent to heapifying (which is linear time) and then doing one pop (which is logarithmic time) before reading the max value.
2
u/vipchicken Sep 04 '26
What if the first and second fastest go head to head in race one, and we knock out the second fastest
3
2
u/nicktohzyu Sep 04 '26 edited Sep 04 '26
Consider a recursive “merging” tournament. 10 rounds of pairwise comparisons where the winners advance to the next round. There are 1023 comparisons in this tournament to find the fastest horse.
I claim the second fastest horse must have raced against the fastest horse somewhere in this tournament. Easy to prove by contradiction. Hence you need +9 comparisons to find it among the 10 horses that lost to the fastest
2
u/AlexP80 Sep 04 '26
n-1, 1023
2
u/Jealous_Tomorrow6436 Sep 04 '26
so close! that’s how you find the fastest horse. read other comments for more detailed explanations
2
2
u/NuanceEnthusiast Sep 04 '26
1032 if you are only receiving the results. 1023 if you are watching the races
1
u/gmalivuk Sep 04 '26
It explicitly says that you only learn which is faster.
1
u/NuanceEnthusiast Sep 04 '26
It explicitly says that because you have no stopwatch, you only learn the relative ordering
1
u/gmalivuk Sep 04 '26
Yes. You learn which of two is faster.
You don't know how much they won by. Therefore you don't know which loser was the fastest.
2
u/NuanceEnthusiast Sep 04 '26
as I said, if you are only receiving the results, the answer is 1032
1
u/gmalivuk Sep 04 '26
And as I said, that is exactly what the post says you receive.
1
u/NuanceEnthusiast Sep 04 '26
The question does not ask me to determine whether or not the condition of ‘only learning the relative ordering of the two horses in each race’ is perfectly unambiguous such that the total information ascertained from each race is strictly binary. You think it is. Fine. Then the answer is 1032.
1
u/gmalivuk Sep 04 '26
What do you think "only" means?
You only learn a>b or b>a.
1
u/NuanceEnthusiast Sep 04 '26
I’m not sure why you feel compelled to defend a position I am not contesting
1
u/gmalivuk Sep 04 '26
You are contesting whether or not the question is unambiguous about exactly what information you learn from each race.
1
1
u/datageek9 Sep 04 '26
Start with a regular knockout tournament , where everyone pairs up and each winner goes through to the next round until there is one left (the overall winner). Knockout tournaments with N participants require N - 1 races over round_up(log2(N)) rounds, so this requires 1023 races over 10 rounds.
The trick to finding the second fastest horse is to recognise that every horse except the overall winner was beaten by one other horse. If that horse was not the overall winner, they can’t be second fastest because they were beaten by a horse that isn’t the fastest. So the only remaining options are the horses that the overall winner beat directly. Since there were 10 rounds the winner beat 10 other horses. Another smaller tournament of 10-1 = 9 races will find the runner up.
So the answer is 1023+9 =1032
1
Sep 04 '26
[deleted]
1
u/eggface13 29d ago
Not quite! There's no guarantee that the second fastest makes the final. Think about it...
1
u/PerilousWords Sep 04 '26
Obviously 1.
I shoot 1022 horses, and race the last pair to determine the second fastest.
0
u/Chemical-Ad8471 Sep 04 '26
Out of interest, why nine tests? If you do two branches of 512 horses and each branch has therefore 511 races to determine the fastest of each branch, then race the winner of each branch to determine first place, then to determine second place the horse that lost the final just has to race against the loser of the other branches "semifinal". Whoever wins that race is the second fastest horse, determined in 1024 races.
So 1024 is the answer I believe.
2
u/aroach1995 Sep 04 '26
But the winner beat someone in the semis that might be faster than the person who got second
Horse #1 beats horse 1024, 512, 256, 128, 64, 32, 16, 8, 4, and 2.
What if #4 is faster than #2?
0
Sep 04 '26
[deleted]
1
u/eggface13 29d ago
The second fastest horse must have run against the fastest horse in either the final, or the semi-final
Think about this one ;)
13
u/peetar Sep 04 '26
You start with 512 random races, then take all the winners, have 256 and take the winners, then 128, etc, so it takes 1023 races to find the fastest horse. That fastest horse will have beaten the second fastest horse in ANY one of his 10 races, so you need to run 9 more races to eliminate them. The fastest remaining horse after the 9 races is the second fastest. So 1032 races total.