array of integers



Hi all,

There is this question that is intriguing me. This is no homework or alike,
I have just come across and would really like to have some hints on how to
attack the problem.

There is an array of integers, without any restriction. How can I come up
with an algorithm to find all combinations of elements that add up to the
numbers in the array. If array is {1, 3, 2, 5, 4}, result would be {1, 2} =
3 is in array; {1, 3} = 4 is in array; {2, 3} = 5 is in array; {1, 4} = 5 is
in array.

I look forward to any inputs, thank you,

-Kemal.


.



Relevant Pages

  • Re: Date Help..!!!Urgent
    ... And don't ask us to do your homework. ... then set an another array, which contains other details along with the ...  For instance, his first night is 2008-12-16, and last is ... overlap and changing prices) that contain the cost for each day. ...
    (comp.lang.php)
  • Re: AB=BA
    ... Since its homework, ... elseif numel>1 ... % verify that A is a square matrix ... error('A must be a real numeric array') ...
    (comp.soft-sys.matlab)
  • Re: problem with code
    ... > hi any hints would be great! ... > #define MySize 8 ... > void FindPosition(int array[]) ...
    (comp.lang.c)
  • Re: Arrays/Literal Notation
    ... seeking help with homework, you should ensure that you do the following: ... My note says that I know the rank (number of dimensions) is 3; ... The rank of the array is 3, its dimensions are 3,1,4. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Returning more than one variable? - Help
    ... >>That sounds to me like a homework problem, and we have this policy of ... >>not doing people's homework for them. ... for an array of 'int' and allocating memory for a pointer to an array ...
    (alt.comp.lang.learn.c-cpp)