Problem:
There are 25 horses and 5 lanes. You have no idea about which horse is better than other.
Find in minimum possible races, the first three fastest running horses.
Solution:
We will have 5 races with all 25 horses
Let the results be
u1,u2,u3,u4,u5
v1,v2,v3,v4,v5
x1,x2,x3,x4,x5
y1,y2,y3,y4,y5
z1,z2,z3,z4,z5
Work through a process of elimination:
Where u1 faster than u2 , u2 faster than u3 etc and
We need to consider only the following set of horses
u1,u2,u3
v1,v2,v3
x1,x2,x3
y1,y2,y3
z1,z2,z3
Race 6
We race u1,v1,x1,y1,z1
Let speed(u1)>speed(v1)>speed(x1)>speed(y1)>speed(z1)
We get u1 as the fastest horse
We can ignore y1,y2,y3,z1,z2 and z3 automatically since those can not be in the top 3.
Now we left with
u2,u3,
v1,v2,v3,
x1,x2,x3,
Race 7
Race u2,u3,v1,v2 and x1 (x2,x3 is ignored since v1,x1 are faster than both, so obvious choices are u2,u3,v1,v2 and x1)
The first and second will be second and third of the whole set
So we need minimum of 7 races to find the 3 fastest horses.
How can u say tat u4 is less faster than v1 or v2 or v3. the solution simply ignores u4 and u5.
SayedAli Dost First read the problem after read the solution.. we want only fastest three horse if all u1 u2 u3 is the fastest to never u4 and u5 comes in this scenario…
why u ignore y1,y2,y3,z1,z2,z3