Ask Experts Questions for FREE Help !
Ask
    meenagaurav's Avatar
    meenagaurav Posts: 1, Reputation: 1
    New Member
     
    #1

    Sep 19, 2007, 02:55 AM
    random addition
    I want help to sum the diff. subset
    You are given n coins, each of different denomination ( for this take n different
    values as input from user).
    Let input is v1,v2,v3------,vn.

    You have to find how many different amounts you can pay by using these n coins.
    asterisk_man's Avatar
    asterisk_man Posts: 476, Reputation: 32
    Full Member
     
    #2

    Sep 21, 2007, 01:13 PM
    pseudo code (implementation is left as an exercise for the reader):

    for 0 < I <= n
    foreach combination genCombinations(vList I)
    print(sum(combination))

    there's probably an easier way to do it since generation of combinations this way will duplicate work but this is the easiest way to describe it.

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

Subpanel for Addition [ 3 Answers ]

My house currently has a 200 amp Service Drop in the rear exterior which includes the 150amp Main breaker. THis supplies a 200amp Breaker box in the garage using 2 awg copper, 40 ft away (two open breakers). We are in the last stages of weathering in a 1000 sq ft addition. I would like to...

Foundation for addition [ 1 Answers ]

Hi, I am planning an addition to the back of my house, aprox. 28' x 32'. My current house is built on wood joists and is about 14-16" above grade. I am trying to figure out the best foundation to build with it considering my constraints. FYI, I do plan to permit it and perhaps find an engineer...

Deed addition [ 2 Answers ]

In the state of North Carolina, do spouse automatically share ownership of property owned before the marriage? Is there any advantages to adding said spouse to deed?

Toilet addition [ 5 Answers ]

There supposedly is a device, kind of like a garbage disposer, that allows you to pump the waste from a toilet through a 2-inch drain pipe. What exactly is that thing and how does it work?


View more questions Search