an algorithm to minimize the total excess [closed] - algorithm

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
Imagine that you have ropes which are 5 meters long. And you want to cut the rope in some certain lengths(30 cm,73 cm) for some certain times. I want to write a program that minimize the total length of the excessed robe and tells you how you should cut every rope. But, I don't know where to start and use what algorithm. Can you give me some reference? Thank you in advance.

What you are looking for is so called Cutting stock problem.
Start by looking at this Wikipedia article and follow Suggested readings. I remember we had this as a part of some course back at the university (although I can't remember which one), so you could have a look at coursera.

Seems like homework, but I can still point you in the right direction. What you have on hand is an example of dynamic programming. From what I can understand from your question, you have a sub-case of the ever popular knapsack problem. Which is in essence an optimization problem of using the space on hand most efficiently, thus reducing the waste. Tweak it a bit to your own needs and you should be able to manage to get the solution for your problem.

Related

Why Adtree has more accuracy than C4.5 [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Improve this question
I've been working on a data mining project lately, and it confuses me a lot that alternating decision tree seems to have more accuracy than WEKA built-in j48 algorithm. I don't have much idea about how these two algorithms are implemented, I hope someone can explain this from the algorithm point of view. Thanks a lot.
I don't have much idea about how these two algorithms are implemented
No one can explain to you why one can perform better than the other if you don't even understand the starting points. Learn about C4.5 and then learn about ADTrees.
Otherwise this would be an exercise in trying to teach you two algorithms in a single giant post - which is futile.

Concurrent algorithm for strongly connected components (SCCs) [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
Is anybody aware of a concurrent version of Tarjan's SCCs algorithm, Kosaraju's algorithm or any other fast, O(|V| + |E|) algorithm for finding SCCs? Neither of those algorithms seem to be very hard to multithread, but I'd be happy for somebody else to have done this job.
What I'm trying to handle here is an 8 GB directed graph, which I keep in RAM using a big AWS instance, and I'd like to make a good use of all 16 cores.
That's possibly the best paper I have found so far, I'll have a go at the implementation. http://domino.research.ibm.com/library/cyberdig.nsf/1e4115aea78b6e7c85256b360066f0d4/d8e3597a4172437b8525709f006e42b0?OpenDocument

Description of the Kameda-Weiner algorithm? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 8 years ago.
Improve this question
I'm looking for an explanation of the Kameda-Weiner algorithm.
I found the paper "On the State Minimization of Nondeterministic Finite Automata" which, I assume, contains this, though it's unfortunately behind a paywall, and I'm just a hobbyist.
Can someone explain the algorithm, or point me to another source?
Although I have absolutely no idea what you are talking about, I think these two pdf files contain some sort of explanation.
Link1
Link2
I just tried to answer it, because I know how frustrating it can be, when you something you really want is behind a paywall! Hope it helps.
Cheers!
It's implemented here: https://github.com/coder0xff/parlex_legacy/blob/132e4a23a599140d22b18ead832626f0c607340f/Automata/NFA.cs#L641
(updated to fix dead link)

How can I come up with creating an algorithm which simulates a real time situation [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I'm good at algorithms but not as good as converting real-time problems and learning them throughly to make it as an algorithm. I would like to know if there is any book/paper that teaches or makes you demystify the situation and formulate it as an algorithm. (Its much like training your mental ability to break the situation and comeup with algorithm in a crisp.)
Showing some of the ways to approach these kinda problems. and any easy learning links/material would help me a lot.
Note: I know SO doesnt allow to ask for the opinion or something vague (I dont mind my Q being downgraded). But I am asking some concrete problem and hope can get some nice info from some of the great minds here.
The word that fits better as a direct answer is "experience". There exists no magical formula to convert a real time problem into some algorithms that solve it. As an analogy, there exist no predefined patterns on how to solve a mathematical problem. It is a mind's task to express the solution, based on some fundamental knowledge and on experience that is accumulated though constant learning.

Challenging Problems Involving Stacks (Data Structures) [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
Does anyone know where I can get lots of challenging programming problems that involve the use of stacks? I'll like to challenge myself with super hard problems.
My Favorite
Convert Prefix expression to Postfix using stack
Implement a stack with O(1) for access to max element
Implement tower of hanoi without
recursion. :)
Take any damn recursive program , which is recursive by intuition, and try to implement it iteratively. Every recursive has a iterative solution.
That should keep you busy for a while. :)
BTW,
Why dont you buy/borrow "Data Structures Using C and C++" by langsam/tennenbaum ?
YOu will get sufficient problem for a week. :)
A Google search for stack data structure problems turns up lots of interesting stuff. Here are a few interesting ones (from easier to harder, in my judgment):
Check for balanced parentheses, braces, and other paired delimiters in text.
Write a postfix calculator. (So 1 3 2 4 + * - should calculate 1 - (3 * (2+4)).)
Use stacks to solve the "N queens" problem. (Place N queens on an N x N chess board so that no two queens are on the same row, column, or diagonal.)
Cracking the Coding Interview, Fourth Edition: 150 Programming Interview Questions and Solutions:
http://www.amazon.com/Cracking-Coding-Interview-Fourth-Programming/dp/145157827X
Chapter 3 is dedicated to stacks and queues questions. Here is a sample question:
How would you design a stack which, in addition to push and pop, also has a function min which returns the minimum element? Push, pop and min should all operate in O(1) time.
You could learn a stack-based language, like Forth, or a stack virtual machine, like MS's CIL VM. Either one will force you to reconsider how you implement anything you write in it to make use of stacks.
Go to the library and look at textbooks on data structures. They should all be shelved together, so you can always just find the call number for your current textbook and the others will be right nearby.
I'd expect most would have chapters specifically on stacks, with end-of-chapter problems. There will be a lot of overlap, but you should be able to get a good selection of problems of varying difficulty, along with a range of different explanations for standard problems.

Resources