Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Sub sums less than IMPORTANT

import

  • Please log in to reply
1 reply to this topic

#1 beg00d

beg00d

    CC Lurker

  • Just Joined
  • Pip
  • 1 posts

Posted 16 December 2011 - 02:30 AM

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.
  • 0

#2 WingedPanther73

WingedPanther73

    A spammer's worst nightmare

  • Moderator
  • 17757 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

Posted 16 December 2011 - 06:29 AM

What have you come up with so far? Can you do it by hand?
  • 0

Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

My MineCraft server site: http://banishedwings.enjin.com/






Also tagged with one or more of these keywords: import

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download