0% found this document useful (0 votes)
17 views3 pages

Steps for Problem Solving

The document outlines a four-step process for problem solving: analyzing the problem, developing an algorithm, coding, and testing/debugging. It emphasizes the importance of understanding the problem and creating a clear algorithm to ensure accurate and efficient solutions. Additionally, it discusses the representation of algorithms through flowcharts and pseudocode, highlighting their roles in showcasing logic and control flow.

Uploaded by

pravanjan dalai
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views3 pages

Steps for Problem Solving

The document outlines a four-step process for problem solving: analyzing the problem, developing an algorithm, coding, and testing/debugging. It emphasizes the importance of understanding the problem and creating a clear algorithm to ensure accurate and efficient solutions. Additionally, it discusses the representation of algorithms through flowcharts and pseudocode, highlighting their roles in showcasing logic and control flow.

Uploaded by

pravanjan dalai
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Steps for Problem Solving

There are four steps in problem solving

1. Analysing the problem,


2. Developing an Algorithm,
3. Coding,
4. Testing and Debugging

2.1 Analysing the problem

• It is important to clearly understand a problem before we begin to find the solution for it.

• If we are not clear as to what is to be solved, we may end up developing a program which may not solve
our purpose.

• By analysing a problem, we would be able to figure out what are the inputs that our program should
accept and the outputs that it should produce.

2.2 Developing an Algorithm

• The solution for a problem is represented in step-by-step procedure called an algorithm.

• For a given problem, more than one algorithm is possible and we have to select the most suitable
solution.

2.3 Coding

• After finalising the algorithm, we need to convert the algorithm into the format which can be understood
by the computer to generate the desired solution.

2.4 Testing and Debugging

• The program created should be tested on various parameters.

• The program should meet the requirements of the user.

• In the presence of syntactical errors, no output will be obtained.

• In case the output generated is incorrect, then the program should be checked forlogical errors, if any

3. Algorithm

Algorithm is the step-by-step procedure for solving the problem. Suppose following are the steps required
for an activity ‘riding a bicycle’:

• remove the bicycle from the stand,

• sit on the seat of the bicycle,

• start peddling,

• use breaks whenever needed and

• stop on reaching the destination

Algorithm to find square of a number.

Step 1: Input a number and store it to num

Step 2: Compute num * num and store it in square

Step 3: Print square

3.1 Why do we need an Algorithm

• Writing an algorithm is mostly considered as a first step to programming.


• Once we have an algorithm to solve a problem, we can write the computer program for giving instructions
to the computer in high level language.

• If the algorithm is correct, computer will run the program correctly, every time.

• So, the purpose of using an algorithm is to increase the reliability, accuracy and efficiency of obtaining
solutions.

Characteristics of a good algorithm

• Precision — the steps are precisely stated or defined.

• Uniqueness — results of each step are uniquely defined and only depend on the input and the result of
the preceding steps.

• Finiteness — the algorithm always stops after a finite number of steps.

• Input — the algorithm receives some input.

• Output — the algorithm produces some output.

While writing an algorithm, it is required to clearly identify the following:

The input to be taken from the user

• Processing or computation to be performed to get the desired result

• The output desired by the user

4. Representation of Algorithms

There are two common methods of representing an algorithm —flowchart and pseudocode.

Either of the methods can be used to represent an algorithm while keeping in mind the

following:

• it showcases the logic of the problem solution, excluding any implementational details

• it clearly reveals the flow of control during execution of the program

4.1 Flowchart — Visual Representation of Algorithms

• A flowchart is a visual representation of an algorithm.

• A flowchart is a diagram made up of boxes, diamonds and other shapes, connected by

arrows.

Symbols Function

4.2 Pseudocode

A pseudocode (pronounced Soo-doh-kohd) is another way of representing an algorithm. It is

considered as a non-formal language that helps programmers to write algorithm. The word

“pseudo” means “not real,” so “pseudocode” means “not real code”. Following are some of

the frequently used keywords while writing pseudocode:

• INPUT / • COMPUTE / • PRINT / • INCREMENT / • DECREMENT


• IF/ELSE, • WHILE , • TRUE / FALSE

Example:

Pseudocode for the sum of two numbers will be:

input num1

input num2

COMPUTE Result = num1 + num2

PRINT Result

You might also like