How should I proceed learning these types of complex algorithms?
I have already learnt how to solve problems related to Breadth First Search like searching a tree. making queues etc. But this algorithm part is making my brain confused. How should I learn algorithms? I can already solve it in my head very simply.
But I little bit understand this below algorithm, but it seems way too complex.
I have reached upto for each actiion in problem. ACTIONS. i understand that it is just elaborating simple things(probably to make writing code easier), but I want to learn it at any cost, although we are not ask this in our examinations.
how should i proceed?
- EddieJLv 74 weeks ago
Different people have different ways of thinking about such things. You have to find a way that works for you.
Usually, students start with very simple algorithms, so they get used to analyzing something that is simple, and then they are gradually introduced to more complexity, so they only have to deal with the small changes in complexity.
One tool that students have is a flowchart -- which the student would have to draw. They can draw the flowchart without understanding everything that is in each box because the shape of the flowchart is ruled by control statements that they should already understand. An <if> is an <if>. A <loop> is a <loop>.
You should learn to "play computer". You are the computer that will run the flowchart. At each point, you are at ONE box. But you need a separate sheet to keep track of the current value of each variable.
You can use the computer to help you if you can use a debugger to execute each command and display the result.
So, as you -- the computer -- execute each command, the question becomes: Do you understand how to process THAT command.
If not, then THAT becomes the specific problem for you to work on, separate from the algorithm as a whole.
The other way to understand an algorithm is to research it (using a search engine). If one author's explanation doesn't make sense, you may be able to find another author who has done a better job explaining it.
And, when you have done all of these things and you are still having problems understanding, hopefully, you have narrowed it down to a particular part and you can ask your teacher about that. Or you can try to ask that here, or other such sites.