@Piyush, yep You are right. it looks correct.
On Sat, May 21, 2011 at 1:25 PM, Piyush Sinha wrote:
> @immanuel...i don't think it will..even if u think it does, provide
> any sample test case
>
> On 5/21/11, immanuel kingston wrote:
> > I think your soln will print repetitions also.
> >
> >
@immanuel...i don't think it will..even if u think it does, provide
any sample test case
On 5/21/11, immanuel kingston wrote:
> I think your soln will print repetitions also.
>
>
> On Mon, May 16, 2011 at 2:34 PM, Piyush Sinha
> wrote:
>
>>
>>
>> *int ref[] = {2,3,6,7,8};*
>> *void printcombi
I think your soln will print repetitions also.
On Mon, May 16, 2011 at 2:34 PM, Piyush Sinha wrote:
>
>
> *int ref[] = {2,3,6,7,8};*
> *void printcombination(int n,int index,int i)
> {
> static int a[100];
> int j;
> if (n == 0)
> {
> for(j=0;j printf("%d ",a[j]);
> prin
Correct. Its a variant of Knapsack problem.
Anuj Agarwal
Engineering is the art of making what you want from things you can get.
On Mon, May 16, 2011 at 4:53 PM, anshu mishra wrote:
> its DP problem can be solved in O(m*n)
> where m is number of elements in array and n is value of the given nu
its DP problem can be solved in O(m*n)
where m is number of elements in array and n is value of the given number.
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe
*int ref[] = {2,3,6,7,8};*
*void printcombination(int n,int index,int i)
{
static int a[100];
int j;
if (n == 0)
{
for(j=0;j0)
{
for(j=i;j<5;j++)
{
a[index]=ref[j];
printcombination(n-ref[j],index+1,j);
}
}
} *
*main()
{
int n;
printf("enter valu