Re: [algogeeks]Numbers search in an array

2010-06-18 Thread Ashish Mishra
take one pointer to start n another to the end say a n b
now if
a +b  X
shift b towards left n so on




On Fri, Jun 18, 2010 at 9:03 AM, sharad kumar aryansmit3...@gmail.comwrote:

 @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.comalgogeeks%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.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
Thanking You
Ashish Mishra

-- 
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.



[algogeeks]Numbers search in an array

2010-06-17 Thread Arunkumar Sreenivasan
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.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks]Numbers search in an array

2010-06-17 Thread Anurag Sharma
Its a repeated question. I would suggest you checking the archives of this
groups for its solution.

Anurag Sharma


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.comalgogeeks%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.