Jump to content

Sub sums less than IMPORTANT

- - - - -

  • Please log in to reply
1 reply to this topic

#1
beg00d

beg00d

    Newbie

  • Members
  • Pip
  • 1 posts
Hello,

Can somebody help me with an algorithm or idea for this problem :

Given a non sorted data (positive integers), find all groups of elements with sum <= X, where X is given.

ex:[

[2 6 3 1]
X = 8

2+6, 2+3, 2+1, 2+3+1, 3+1, 6+1 ]

I need 3 solutions / algorithms, one that is time efficient, one memory efficient, and a trade-off between the two.

Appreciate any help.

#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others
What have you come up with so far? Can you do it by hand?
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users