Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 159855
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T10:55:55+00:00 2026-05-11T10:55:55+00:00

I have a bit of a problem with the algorithm proposed as homework by

  • 0

I have a bit of a problem with the algorithm proposed as homework by our teachers. It goes something like this:

Having a number of sticks like so:

4 (the number of piles to use)

11 7 5 4 (length of the sticks)

1 1 3 3 (how many sticks per length)

I have to figure out an algorithm that will form the minimal number of sticks by merging them. The solution for the previous example is this:

15 3 (15(optimal sum) * 3(minimal sticks) = 45 = 11*1 + 7*1 + 5*3 + 4*3)

11 4

7 4 4

5 5 5

Now I am not asking for you guys to solve this problem, but to give me a line to follow, I have tried to reduce it to a ‘Make Change’ problem, it went good until the part where I had to select from the remaining solutions the good ones.

The complexity desired is an exponential one and the restrictions are:

  1. 0 < sticks < 100
  2. 0 < max_sum_of_sticks < 1000

So do you guys have a second thought on this?

Thank you very much for your time.

Explanation on minimal number of sticks : if for instance i had a set of sticks. The sum to be formed is 80, i have a fair amount of solutions :

1 stick of length 80

2 sticks of length 40

4 sticks of length 20 so on.

The first one is trivial and we discard it,for the remaining solutions I have to test if I can build them with the sets of sticks I have because there is a possibility that the solution chosen, for example 2*40, isn’t a reliable one because we have sticks that were not used.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T10:55:56+00:00Added an answer on May 11, 2026 at 10:55 am

    This looks a lot like the Knapsack problem.

    You might also take a look at Branch and bound, which is a general algorithm for all kinds of optimization problems.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 82k
  • Answers 82k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Try moving the line: webBrowser1.Document.Title = "foobar!"; into your wb_c… May 11, 2026 at 4:42 pm
  • Editorial Team
    Editorial Team added an answer Referencing System.Web and using HttpContext.Current.User.Identity.Name worked like a charm. I… May 11, 2026 at 4:42 pm
  • Editorial Team
    Editorial Team added an answer According to the OpenJDK7 source code for javax.net.SocketFactory, the Sun… May 11, 2026 at 4:42 pm

Related Questions

My math classes are far behind, and I'm currently struggling to find a decent
What is an effective algorithm for nesting 1 dimensional lengths into predefined stock lengths?
I am writing a program that will draw a solid along the curve of
Avast there fellow programmers! I have the following problem: I have two rectangles overlapping

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.