create an array of all possible PAIR sums..that would be done in O(n^2)..sort it..O(log(n))now..search this array for two pairs..that sum to the required value.. this can be done by maintaining two index..one at the lowest value..one at the highest value..and moving them accordingly..(if sum of pair exceeds given value..move up highest value pointer..else move down..lowest value pointer)
On Sat, Aug 27, 2011 at 10:59 PM, tech coder <[email protected]>wrote: > Given an array A[] and a integer num. Find four no.s in the array whose sum > is equal to given num. > > -- > 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. > -- *Dheeraj Sharma* Comp Engg. NIT Kurukshetra +91 8950264227 -- 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.
