Guys, this is going in totally different direction. Solution given by Shishir (using Max-Heap) works perfectly. If anybody has any better solution please put it here, or lets close the topic. -Nayn
On Sep 5, 5:11 pm, sharad kumar <aryansmit3...@gmail.com> wrote: > divide the horses into 5 groups a,b,c,d,e number them as a1,a2,..,a5, > b1..b5, c1..c5, d1..d5 and e1..e5. Conduct 5 races within the groups. Youve > 15 winners (3 frm each race). a1,a2,a3,b1,b2,b3...,e1,e2,e3. Now conduct a > sixth race among a1,b1,c1,d1,e1. Youve 3 winners say they are a1,b1,c1. Now > you can eliminate all the d's and e's. since d1 and e1 isnt even in the top > 3. You also eliminate b3,c2,c3 as they cannot be in the top 3 as there are > already altleast 3 horses faster than them. After this elimination, you are > left with a1,a2,a3,b1,b2,c1. > a1 is the fastest of them all. So conduct a 7th race among a2,a3,b1,b2,c1 to > determine the next 2. > > > > On Sat, Sep 5, 2009 at 5:18 PM, manoj janoti <m.jan...@gmail.com> wrote: > > If someone gives the answer of this puzzle can easily solve this puzzle. > > > There are 25 horses. > > We have to find out 3 most fastest horses among them. > > But there are only 5 tracks in the field i.e only 5 horses can run at a > > time. > > > manoj > > > On Sat, Sep 5, 2009 at 4:40 PM, Ajith G <ajith...@gmail.com> wrote: > > >> i think this doesnt work. > >> consider first million numbers all of them to be 1. > >> next million number(all of them ) to be 2. > >> and so on.... > > >> if you take first element from each million then you will end up with > >> 1,2........ > >> but the smallest million numbers are all 1. > > >> On Fri, Sep 4, 2009 at 8:29 AM, viswanath ramakrishnan < > >> srviswanat...@gmail.com> wrote: > > >>> Q.3: Given a set of 1 Trillion integers on hard disk, find the > >>> smallest 1 > >>> million of them. You can fit at most 1 million integers in memory at a > >>> time. > >>> State the fastest solution you can think of. > > >>> take the first 1 million out of 1 trillion and sort the 1 million > >>> integersand store it back in the hard disk. > >>> In this way carry on the sorting for every group of 1 million integers > >>> and store it in the hard drive . Now groups of 1 million integers are > >>> sorted upto 1 trillion. > >>> now compare the first element of all the sorted groups the minimum of > >>> them is the minimum of the 1 trillion. store it as the first element > >>> in the memory. > >>> next take the second element from the group from which the smallest > >>> elemnt came and then check it with all other groups first element. > >>> In this way repeat the procedureuntil the first 1 million is sorted > >>> and stored in the memory. > > >>> correct me if i am wrong..... --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/algogeeks -~----------~----~----~----~------~----~------~--~---