I think we can use a Linked List. Sort it and then find numbers adding upto x.
On Fri, Jun 11, 2010 at 9:39 PM, Raj N <[email protected]> wrote: > @sharad: Does it have to return the first pair or all possible pairs ? > > > On Fri, Jun 11, 2010 at 6:56 PM, sharad <[email protected]> wrote: > >> Given a large file, having N (N is very large) positive integers, how >> will you find a pair of numbers that add up to x (eg. 100). What data >> structure will you use and give appropriate Algo/code. It should be >> efficient in time and space. >> >> -- >> 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. >> >> > -- > 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. > -- 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.
