What is an algorithm?
Whether you are learning to code or learning anything related to programming you would have heard of the term 'algorithm'. An algorithm is a series of instructions in a particular order that the computer processes in that order. For an example, let us take the algorithm a smart car uses to navigate from my house to my cousin's. This is how it goes:
A car will process this according to the sequence. A car wouldn't randomly read any line. Like this, you can make your own algorithms. There are lots of algorithm makers online.
Depending on the function, there are different shapes used in an algorithm. For example, the square is for a process, the 'D shape' is for a delay, etc.
When doing proper coding, you will use this code. We use it when there is a condition that is being met. I have attached a few lines of QBasic here. The great thing about this code is it is easy to understand and won't take any effort to decode.
INPUT (Any number);x
INPUT (Another number to compare with); y
IF x < y THEN
PRINT(x + "IS LESSER THAN" + y)
ELSEIF x > y THEN
PRINT(x + "IS GREATER THAN" + y)
ELSE:
PRINT("the first number equals to the second number")
If you can't understand it, I have programmed the computer to ask the user for 2 numbers. If the first number is bigger than the second number, the computer will print {the first number} IS GREATER THAN {the second number}. Else if the first number is smaller, then the computer is going to print {the first number} IS LESSER THAN {the second number}. Else (the only other result of the comparison is that the numbers are equal) the computer is going to print "the first number equals the second number".
I have made a small list of algorithms you could make just for practice:
_______________________________________
I would request everyone to please put a comment for suggestions for more topics. Thank you.
A car will process this according to the sequence. A car wouldn't randomly read any line. Like this, you can make your own algorithms. There are lots of algorithm makers online.
Depending on the function, there are different shapes used in an algorithm. For example, the square is for a process, the 'D shape' is for a delay, etc.
When doing proper coding, you will use this code. We use it when there is a condition that is being met. I have attached a few lines of QBasic here. The great thing about this code is it is easy to understand and won't take any effort to decode.
INPUT (Any number);x
INPUT (Another number to compare with); y
IF x < y THEN
PRINT(x + "IS LESSER THAN" + y)
ELSEIF x > y THEN
PRINT(x + "IS GREATER THAN" + y)
ELSE:
PRINT("the first number equals to the second number")
If you can't understand it, I have programmed the computer to ask the user for 2 numbers. If the first number is bigger than the second number, the computer will print {the first number} IS GREATER THAN {the second number}. Else if the first number is smaller, then the computer is going to print {the first number} IS LESSER THAN {the second number}. Else (the only other result of the comparison is that the numbers are equal) the computer is going to print "the first number equals the second number".
I have made a small list of algorithms you could make just for practice:
- How you plan your day.
- How you do gardening
- How you will go to the office (how you check if you have taken everything)
_______________________________________
I would request everyone to please put a comment for suggestions for more topics. Thank you.
Comments
Post a Comment
Please leave a comment for any feedback or suggestions.