A
A
Alexey2014-04-09 17:30:55
Combinatorics
Alexey, 2014-04-09 17:30:55

How to implement an algorithm for finding possible combinations?

Hello!
Tell me how to implement the following algorithm:
There is a list of numbers, you need to find all possible combinations of obtaining a given number from these numbers by summation.
For example:
Given - 2, 5, 1, 10, 1, 6, 12, 4, 2, 1
Find combinations of obtaining 13
Output - (2; 10; 1), (6; 4; 2; 1), (6 ; 2; 2; 1; 1; 1), (10; 1; 1; 1), (10; 2; 1), (12; 1), (6; 5; 2), (6; 5; 1 ; 1), etc.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question