step 1: Sort array in place. Lets call it A. (N log N)
step 2: Create two additional copies of array, lets call them B and C. (this
is just for explanation, we can operate on same array A).
step 3: Take first element from array A. lets say its value is X. Find pair
from B and C whose sum is
http://geeksforgeeks.org/ can be helpful. You can also find links to
tutorials/articles http://geeksforgeeks.org/?page_id=6028
On Fri, May 21, 2010 at 3:57 AM, sharad kumar aryansmit3...@gmail.comwrote:
@venky
pls c www.topcoder.com/tc its gt tutorials,srm matches etc.
On Fri, May 21, 2010
Find the median of the values and move the lower values to left and higher
values to the right. This can be done in o(n). now do the same on both the
parts recursively. And the total complexity will be o(nlogk).
On Fri, May 21, 2010 at 1:12 PM, Shachin Sharma shac...@gmail.com wrote:
No