@arun:find out the difference x-arr[i] for all i=0..n hash it ...next search for a number with difference .u can get it in O(n)....
On Fri, Jun 18, 2010 at 8:05 AM, Arunkumar Sreenivasan < thegame.a...@gmail.com> wrote: > Hi, > You are given a set of numbers and another number 'x'. You have to find > if there exists any two numbers, whose sum is equal to 'x'. I have done this > is o(n)log n. Need a more optimized solution. > > regards, > Arun kumar S > > -- > 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. > -- yezhu malai vaasa venkataramana Govinda Govinda -- 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.