[algogeeks] Re: combinations problem

2011-01-09 Thread SVIX
knapsack typically tries to maximize one attribute while minimizing some other (or optimal max for both or similar such conditions)... for this problem, all we need to do is find one subset that adds up to the given number... there's no second criteria to maximize/minimize... Please correct me if

[algogeeks] Re: combinations problem

2011-01-09 Thread juver++
As I've stated, problem is similar to the 0-1 knapsack. Find subset of elements which sums up to a given value. Possible transitions - to take or not to take particular element. That's why it's 0-1 knspsack. -- You received this message because you are subscribed to the Google Groups Algorithm

[algogeeks] Re: combinations problem

2010-12-29 Thread suhash
Is'nt this just a knapsack problem! On Dec 29, 3:45 pm, rajeev kumar rajeevprasa...@gmail.com wrote: you are given a string.It may have repeated characters.each character has it's own weight.find combination of characters whose sum value is equal to given value. ex: given string

Re: [algogeeks] Re: combinations problem

2010-12-29 Thread rajeev kumar
String gives no of occurrences of each character.no of times you select a character should be less than the no of times it appears in the string. ex: given string 'abcbacbabcc' has 3 a's, 4b's, 4 c's. resulting string should have a less than 3 times,b less than 4 times and c less than 4 times.

Re: [algogeeks] Re: combinations problem

2010-12-29 Thread juver++
It's a knapsack problem with bounds. Solve it using DP - for each state keep number of used characters and preserve to exceed the bounds. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to

Re: [algogeeks] Re: combinations problem

2010-12-29 Thread rajeev kumar
@juver++ can you elaborate this sentence 'It's a knapsack problem with bounds. Solve it using DP' or send me any link which has good explanation. On Wed, Dec 29, 2010 at 4:52 PM, vishal raja vishal.ge...@gmail.com wrote: i think we don't need to store the total no. of occurance of any

Re: [algogeeks] Re: combinations problem

2010-12-29 Thread juver++
Yes, it's true. But we should process DP in the following order not to take one element more than once. -- 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

Re: [algogeeks] Re: combinations problem

2010-12-29 Thread vishal raja
@juver, ofcourse , and that's not a big deal. On Wed, Dec 29, 2010 at 5:11 PM, juver++ avpostni...@gmail.com wrote: Yes, it's true. But we should process DP in the following order not to take one element more than once. -- You received this message because you are subscribed to the Google

Re: [algogeeks] Re: combinations problem

2010-12-29 Thread juver++
dp[i][j] - true, if there is a way to have sum j after processing the first i elements, and false otherwise. so transitions wil be: dp[i][j] = dp[i - 1][j] OR dp[i - 1][j - weight[i]], (OR means logical or),first term means that we don't want to use i-th character, second - we use it, so the

Re: [algogeeks] Re: combinations problem

2010-12-29 Thread juver++
It's not a big problem when you use 2D matrix instead of 1D for the DP :) -- 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] Re: combinations problem

2008-09-17 Thread [EMAIL PROTECTED]
isn't it an application of association rule mining. http://en.wikipedia.org/wiki/Association_rule just that ARM will mostly result multiple solution depending on your data. Its up to you to decide a strategy for breaking ties. On Aug 15, 1:19 am, Geoffrey Summerhayes [EMAIL PROTECTED] wrote: On