http://mathoverflow.net/questions/57371/find-all-maximal-subsets-of-a-set-of-integers-whose-sum-does-not-exceed-a-number actual question is this.
On Sat, Aug 27, 2011 at 9:56 AM, rahul sharma <[email protected]>wrote: > yeah i wen first post answer i said it is for finding sum=k; > n just add one more condition in loop for finding <k; > i.e. if(sub+a[i]<k) > return sub,a[i]; > > is it fine nw? > > On Sat, Aug 27, 2011 at 7:55 AM, raj kumar <[email protected]>wrote: > >> It's not knapsack in knapsack we find max or min subset here we have to >> find all subsets <=k not just one which is min or max , so I guess we have >> to form all subsets and check their sum hence the algoritm will be 0(2^n) >> where n is number of elements in the set , >> >> se correct me if i am wrong or a better solution exists >> >> >> thanks >> >> -- >> 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. >> > > -- > 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. > -- 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.
