0% found this document useful (0 votes)
18 views

Revision Notes - 28 Problem Solving and Algorithm Design

Uploaded by

Reem elhady
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

Revision Notes - 28 Problem Solving and Algorithm Design

Uploaded by

Reem elhady
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 11

Teach Computer Science

Problem solving
and algorithm
design

teachcomputerscience.com
1.

Revision notes

teachcomputerscience.com
Introduction
To program a computer, certain sets of logical instructions need to be
provided. Sets of logical instructions for a computer can be designed
only when the programmer thinks in the same way that a computer
processes the instructions. Computational thinking is a thought
process involved in formulating a problem and expressing its solution
in such a way that computers can effectively carry it out.
Developing software is a complex process as it involves:
• Innovative thinking process. It is quite difficult to create a new
software which has not been done ever before.
• Complex testing procedures to check the functionality of software.
Software does not obey physical laws and to determine its
properties, its developer must test it under different conditions.
Software engineering describes structured methodology and
techniques to develop new software. Testing software is now made a
disciplined process too.
Computational thinking is beneficial in many ways and has changed
the way computer scientists look at the software developed process to
a more structured process. Using this, a complex problem is
understood by breaking into various modules that be further solved
individually. The solution obtained may involve a computer, a human
or both.
The components of computational thinking are:
a) Abstraction
b) Decomposition
c) Algorithm design

teachcomputerscience.com
Problem solving
The various steps followed when solving a problem are:
i. Understand the problem
Understanding the problem is the first step to problem-solving. To
understand the problem we need all data to understand the problem.
It is also important to check whether the problem is solvable. If it is
solvable, a complex problem can be broken down into simpler
modules, that can be further solved individually.
ii. Construct a plan to solve the problem
To simply a developer work, he/she may check whether this type of
problem has been solved earlier. If yes, then that plan may be adapted
to suit our needs. Some problems can also be solved using
mathematics.
iii. Apply the plan
The plan is carried out and it is important to check at every step that
what we are doing is correct.
iv. Check for errors and look for improvements in the current plan
The final step of problem-solving it to check whether the solution is
correct. The solution must be efficient and reusable in future. In case
of errors, it has to be identified, then solved and the complete solution
is checked again.

teachcomputerscience.com
Abstraction
Abstraction is similar to generalisation. In the study of objects or
systems, certain characteristics are removed so that it is reduced to a
simple set of characteristics. Let us consider a real-life example of a
driver driving a car. It is enough for the driver to understand the use
of the accelerator and breaks, etc. He need not know the inner
mechanism behind the accelerator and brakes. This is hiding the
details that are not essential. Data abstraction therefore reduces the
complexity and time.

Figure 1: Abstraction

Using symbols to represent physical quantities during a physics


experiment is an example for abstraction. Similarly, variables are
used in programming. You must be familiar with functions in maths.
Similarly, functions in programming helps us to simply a solution. In
networking, layers are separated according to functionality. This
separation allows network professionals to work on each layer
separately.

teachcomputerscience.com
Decomposition
To program a computer, certain sets of logical instructions need to
Decomposition
A large problem is broken down into smaller chunks that can then be
solved using computing. Let us take an example of designing an
online airline ticket booking system. Many programmers work
together. Each programmer is assigned a particular job. One creates
the database related to the airline, like time schedule, number of
seats and cost of the tickets. One programmer designs the
interactive page that takes input from the user. One programmer
designs the online banking interface. Decomposition of a task is
illustrated in the following figure.

Figure 2: Decomposition of a task

Pattern recognition
Patterns in a problem simplify developers work. Similar problems
can be solved by the same solutions. Reusing these solutions saves
effort and time.
For example: For creating an online application to read magazines,
the program for creating user accounts, subscriptions and banking
details are be recreated using similar programs that are already in
use by other applications.

teachcomputerscience.com
Algorithm design
The problem is broken into a series of logical steps called an
algorithm. For example, to design a program to multiply two numbers,
logical steps have to be provided. Repeated addition is the widely used
logic behind multiplication.
Algorithms are represented in the form of a flowchart or pseudocode.
A flowchart depicts the steps and order to be followed to perform a
task. Pseudocode is a method of representing an algorithm using
simple words and mathematical operators.
In the following flowchart to check whether a number is odd or even, a
decision box is used to check whether a number divided by 2 is 0 or
not. This decision box has one entry point and two exit points.
Sometimes a decision box may have more than two exit points.

Figure 3: Algorithm in a flowchart


Pseudo code:
INPUT Num
IF Num MOD 2 = 0
THEN PRINT Num, “is an even number”
ELSE PRINT Num, “is an odd number”
ENDIF
teachcomputerscience.com
2.

Activity

teachcomputerscience.com
Activity
Duration: 15 minutes

1. Deduce an algorithm to check whether a number is divisible by 6


or not. Complete the boxes below with logic used, flowchart and
pseudocode.

Logic used:

Flowchart:

Pseudocode:

teachcomputerscience.com
3.
End of topic
questions

teachcomputerscience.com
End of topic questions
1. What are the components of computational thinking?
2. What are the various steps involved in problem solving?
3. What is abstraction? Explain with an example.
4. How is decomposition helpful in software development?
5. How does pattern recognition save time and effort in software
development?
6. What is an algorithm? In what forms, is it represented ?

teachcomputerscience.com

You might also like