No one can learn programming and solve problems without knowing algorithms.


Algorithms are about taking a set of steps to solve the problem in the simplest way. You can ask why do we need algorithms for programming?


One thing we must understand is that a computer has no mind, meaning it cannot think, unlike a human. If you tell it anything, it will understand it.


Directly, but the computer must tell it all the steps that must be followed to do that thing, and if you forget to tell it a step or make a mistake in it, it will not understand the matter, and the steps are algorithms.


Any program you want to design before you implement it in any programming language must be written in the form of pseudocode, which is the organization of the steps that you will follow and the method of writing them, like any method of writing a programming language, so you must use it first so that your brain is qualified for programming.


Example:


If I want the computer to find a name for me, I type the following steps


1 Pick up phone book 

2 Open to middle of phone book 

3 Look at page 

4 If person is on page 

5      Call person 

6 Else if person is earlier in book 

7      Open to middle of left half of book 

8      Go back to line 3 

9 Else if person is later in book 

10    Open to middle of right half of book 

11    Go back to line 3 

12Else 

13    Quit 

If you notice, you will find that there are basics to these commands, which are commands, conditional statements, repetition, and there are many other commands that I will try to learn in the future.

Comments

Popular posts from this blog

#5