Hi,

I just modified the powerset problem to print only if the sum is matched as
below.

http://codepad.org/B72idYnp

I think this algo is order of exponential time on number of elements in the
set.

I would be interested to know if there are more efficient algorithms.

Thanks,
Balaji.

On Mon, Jan 24, 2011 at 3:24 PM, UMESH KUMAR <[email protected]>wrote:

> hello..........................
>
>  Qs:- Given an Array of contain elements range from 1 to 9 find
>         all possible subsets and print all subsets  whose sum is 10,
>
>         Assume all elements in the array are distinct.
>
>         Exa:- input:---{1,2,6,3,4};
>
>                  Output:-
>                   {4,6}, {1,6,3}, {1,2,3,4}
>
>                 input :-{9,8,7,6};
>                 output:-
>                        No
>
>  Thanks And Regards
> Umesh Kumar
>
>  --
> 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]<algogeeks%[email protected]>
> .
> 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 [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