On Fri, Dec 24, 2010 at 3:02 PM, bittu <[email protected]> wrote:
> You Have File of Containing 1 Million Integers You need To Find 10 > Maximum Integer Out of Them.How You Will Do That ...what is Time & > space Complexcity of Algorithm that you will use....then optrmize the > solution.. > > Constraints- U can't Store Whole File in memory @ one time e.g. if u > will do that gigabyt eof memory may be required so that should be > avoided. > > > Regards > Shashank Mani Narayan > Birla Instute of Technology,Mesra > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<algogeeks%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > > Use External sorting. Divide the file data into smaller chunks. Sort the chunks of data one at a time and save them back to file. Then get top values from the chunks and sort them again till you get top 10 values. -- Dinesh Bansal The Law of Win says, "Let's not do it your way or my way; let's do it the best way." -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
