U
U
Urukhayy2016-08-12 13:07:14
Programming
Urukhayy, 2016-08-12 13:07:14

Is a universal abstract algorithm of approach to solving non-trivial problems possible?

For example, there is a problem about the Towers of Hanoi .
One of the experienced programmers proposed a recursion solution to this problem: it is very elegant, and takes only 20-30 lines of complex Java code. But to understand what is happening there, inside, in recursion, is not so simple - that's why this is a recursive solution. But after all, this recursive solution was somehow approached, and the task is not trivial. Is there a general abstract algorithm for solving such unusual problems? Perhaps there is something like a plan: analysis, examination of the boundaries of the problem, etc.
So that in cases where a new unusual task arises, no time would be spent on wrong decisions, or less time would be spent.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
L
Lander, 2016-08-12
@usdglander

Non-trivial problems are non-trivial because there is no general solution method for them. Usually you just need to look at the problem from the right angle so that the solution comes by itself!

R
Rou1997, 2016-08-12
@Rou1997

Yes, there is only one solution for all problems in programming.

R
Rsa97, 2016-08-12
@Rsa97

In fact, the Tower of Hanoi is an example of a trivial problem, and it is almost always solved by recursion, according to the principle of induction - solving the problem of shifting N rings from rod A to rod C is shifting N-1 rings from A to B, 1 rings from A to C and N-1 rings from B to C.

G
gghaker, 2016-08-16
@gghaker

Simplify the task to disgrace and / or present it differently and again simplify to disgrace, after which the brain turns on and "highlights" possible solutions.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question