KEMBAR78
Algorithm Design and Problem Solving | PDF | Algorithms | Computer Programming
0% found this document useful (0 votes)
8 views31 pages

Algorithm Design and Problem Solving

Uploaded by

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

Algorithm Design and Problem Solving

Uploaded by

muntahanoor
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 31

Algorithm Design and

Problem Solving
Chapter 7
Understand the program
development life cycle ( Analysis,
Design, Coding and Testing)
Computer Systems , Sub
Systems And Decomposition
Decompositi
on:
• This is the act of breaking down a large problem into smaller,
clear, manageable and understandable sub-parts. Sub-parts can
be divided until they are easily solvable and cannot be broken
down any further.

• Once the requirements document has been created, developers


need to design the structure and algorithms to solve the problem:
• Structure charts are created to show the breakdown of tasks in a
hierarchy
• Flowcharts may be created to visually show how tasks should be carried
out
• Pseudocode is created, sometimes from flowcharts, to allow programmers
to easily translate task instructions into programming code
• The design of a solution identifies what tasks need
completing, how to complete the tasks and how each task
works together with other tasks

• A computer system includes several components that


work together: software, hardware, data, networking and
people

• Systems can be broken down into sub-systems that can


be further broken down into more sub-systems, until each
sub-system has a single purpose. This decomposition is
known as top-down design
Decomposing a system
• To create an overall system and solve a problem, it must first
be broken down into subsystems that are easier to solve and
create. The act of breaking down the problem is known as
stepwise refinement

• Decomposing the problem this way creates smaller, more


manageable and more easily understandable sub-parts

• Each sub-system can be assigned to a developer or group of


developers who create subroutines from these sub-systems.
Each sub-system can then be created at the same time,
reducing development and testing time, especially on large
projects
• Decomposing the system using stepwise refinement
requires developers to think about four key areas:

• Inputs: data entered into the system


• Processes: subroutines and algorithms that turn inputs
and stored data into outputs
• Outputs: data that is produced by the system, such as
information on a screen or printed information
• Storage: data that is stored on a physical device, such
as on a hard drive

• To solve a problem all aspects must be thoroughly


understood by the developers
Structure Diagrams

• Structure diagrams show


hierarchical top-down design in a
visual form. Each problem is
divided into sub-problems and
each sub-problem divided into
further sub-problems. At each
level the problem is broken down
into more detailed tasks that can
be implemented using a single
subroutine
Flowcharts
• Flowcharts show how algorithms can be represented
visually in a diagrammatic format
• Each flowchart has a start and an end with arrows
showing the order each task or instruction needs to be
carried out in
• Flowcharts are made of several symbols
Pseudocode
• Pseudocode is a programming-like language that does not have syntax. It can
be considered “fake” code.

• It uses english words and phrases to represent instructions and is very similar
to programming code but does not and cannot run on any computer

• The purpose of pseudocode is to allow developers to understand how to


create a program regardless of the programming language used to implement
the solution

• While pseudocode has no specific syntax, it is important to stick to a


consistent style. This will make it easier and quicker for programmers to read
and create programs from the pseudocode
• Examples of a consistent style can include:
• Keywords are written in capital letters e.g. INPUT, OUTPUT, IF, THEN, ELSE
• Variable and subroutine names start with capital letters e.g. Age, Name, Date, CalculateArea, Sortlist
Pseudocode (cont)

• While pseudocode has no specific syntax, it is important to stick


to a consistent style. This will make it easier and quicker for
programmers to read and create programs from the pseudocode

• Examples of a consistent style can include:


• Keywords are written in capital letters e.g. INPUT, OUTPUT,
IF, THEN, ELSE
• Variable and subroutine names start with capital letters
e.g. Age, Name, Date, CalculateArea, Sortlist
• Indentation can be used for iteration and selection

You might also like