take h as array/has table as max element of a as size.
just a psecudeocde.....
for(i=0;i<n;i++)
{

sub=k-a[i];
if(h[a[i]]==1)
return (a[i],sub);

h[a[i]]=1;

}

log n complexity for all subsets of sum=k;;;
just add one more condition in loop for checkeing < also.......
coreect if m wrng??

On Aug 26, 10:43 pm, Piyush Grover <[email protected]> wrote:
> Here is a problem:
>
> Given an array of size n. Find all the MAXIMAL subsets whose sum is <= K.
> The solution is not a concern, the optimization is required.
>
> -piyush

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

Reply via email to