Week-4-Algorithm-and-Pseudocode
Week-4-Algorithm-and-Pseudocode
Algorithm and Pseudocode are the two related terms in computer programming. The basic difference
between algorithm and pseudocode is that an algorithm is a step-by-step procedure developed to solve a
problem, while a pseudocode is a technique of developing an algorithm.
Activity
Algorithm
A sequence of steps to solve a given problem is called as algorithm. Thus, an algorithm is a step-by-step
procedure developed for solving a given problem. An algorithm consists of sequences, iterations, selections,
etc. The selection of an algorithm depends upon the nature of the given problem. Thus, the problem is first
analyzed, and then the best algorithm is used to solve it.
An algorithm follows a systematic and a logical approach, where the procedure is defined step-wise. In an
algorithm, many simple operations are combined to help form a more complicated operation, which is
performed with ease by the computer. Characteristics of a good algorithm include:
Pseudocode
Is an informal method of developing an algorithm. Thus, computer programmers use simple informal language
to write a pseudocode. It does not have any specific syntax to follow. The pseudocode is a text based design
tool. Basically, pseudocode represents an algorithm to solve a problem in natural language and mathematical
notations.
Pseudocodes are written in plain English, and they use short phrases to represent the functionalities that the
specific lines of code would do. Since there is no strict syntax to follow in pseudocode writing, they are
relatively difficult to debug.
Example of Pseudocode
Problem: Compute and display the average of 3 numbers
Steps:
1. Input num1
2. Input num2
3. Input num3
4. sum = num1 + num2 + num3
5. average = sum / 3
6. Display average
Key Differences:
Algorithm is a general concept referring to a step-by-step procedure.
Pseudocode is a way to express the steps of an algorithm in a structured but informal manner.
Both are essential for planning and communicating logic before writing actual code.
References:
https://www.tutorialspoint.com/difference-between-algorithm-and-pseudocode