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 <rajn...@gmail.com> wrote: > @sharad: Does it have to return the first pair or all possible pairs ? > > > On Fri, Jun 11, 2010 at 6:56 PM, sharad <sharad20073...@gmail.com> 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 algoge...@googlegroups.com. >> To unsubscribe from this group, send email to >> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com> >> . >> 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 algoge...@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com> > . > 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 algoge...@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?hl=en.