@Ashish
Your second approach wont work. It should be solved by dyanamic programming
,you using greedy method
what happen if we need the sum 50 and our array is

1 1 1 27 1 1 1 25 25 1 1 1 1 1 1
now after sorting
1 1 1 1 1 1  1 1 1 1 1 1 25 25 27
your algo reject last two numbers and it wont lead to the solution

in short do anybody know a algo less than O(N^2)

-- 
Regards
Jitendra Kushwaha
MNNIT, Allahabad

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

Reply via email to