All Questions
6 questions
21
votes
3
answers
4k
views
Loading military units into ships optimally, using backtracking
I solved the following problem using backtracking:
We are given a list of military units, their weight and their
(numerical) strength. We have a number of ships with a limited
carrying capacity. ...
4
votes
3
answers
1k
views
Java Magic square program
Here is my improved version of my Magic square program from following this earlier version.
I also added a few comments.
Any help for improvements would be really appreciated.
...
3
votes
1
answer
684
views
Speed up Magic square program
I have written a Java program to calculate magic squares with recursion and backtracking. A 3*3 Magic square is calculated in about 1 sec, but a 4*4 needs about 50 minutes on my laptop with Intel i5. ...
5
votes
2
answers
2k
views
Two approaches to print all permutations - returning versus passing through the “result” list
I have noticed many of the backtracking problems have two ways of solving.
One is to return "whatever's the required list", vs passing-through the "result" to every call and appending to it. What is ...
2
votes
1
answer
2k
views
Knight's tour code
Another one for some late night snack. - Knight's tour!
Please provide your suggestions/flaws/optimization to this knight's tour backtracking code..
...
10
votes
2
answers
936
views
Finding path in Maze
I recently gave an interview and was asked the following question. I posted this here
Finding path in Maze also, and someone suggested I should try Code Review. So here it goes.
A maze is a group of ...