Algorithm Design And Problem Solving
Algorithm Design And Problem Solving
I know Terms:
1. The stages in the program development cycle
6. Standard methods of solutions like (linear search, bubble sort, totalling, counting. Etc.)
Remember that the PDLC is not strictly linear; it involves interactions and iterations.
Continual refinement and adaptation are essential throughout the development
process. By following these steps, software development teams can create high-quality
applications.
o Examples of subsystems:
Remember, understanding these concepts helps us appreciate how computer systems are
organized and interconnected!
Decomposing a problem
1. Decomposing a Problem:
o By doing so, we can analyse, understand, and address each part independently.
2. Why Decompose?
Example:
» Inputs – time to set the alarm, remove a previously set alarm time, switch an alarm o , press
snooze button
» Processes – continuously check if the current time matches an alarm time that has been set,
storage and removal of alarm times, management of snooze
» Outputs – continuous sound/tune (at alarm time or after snooze time expired)
Structure Diagrams
Overview:
Structure diagrams, also known as hierarchy charts or module diagrams, are used to represent
the breakdown of a system or a problem into smaller sub-problems or modules. They visually
depict the relationship between the di erent components of a system, showing how they are
connected and how they interact with each other.
Key Features:
Modularity: Structure diagrams emphasize the modular nature of a system, where each
module represents a distinct function or process.
Interrelationships: The diagram shows how the modules are related, indicating the flow
of control and data between them.
Example:
Pseudocode
Overview:
Key Features:
Flexibility: It can be easily translated into actual code in any programming language.
OUTPUT
// OUTPUT {value}
Hello World
// INPUT {identifier}
INPUT Name
// Storing Number
Counter <- 12
// Storing STRING
Handling Conditions
THEN
OUTPUT Tax
ELSE
OUTPUT Tax
ENDIF
Loops:
FOR Index ← 1 TO 10
OUTPUT Index
NEXT Index
FOR Index ← 1 TO 10
StudentNames[1] ← ""
NEXT Index
StudentNames[1] ← "Jim"
StudentNames[2] ← "Tony"
StudentNames[3] ← "Bob"
Index ← 1
OUTPUT StudentNames[Index]
Index ← Index + 1
ENDWHILE
Function on Pseudocode
PROCEDURE PrintIt
OUTPUT ""
ENDPROCEDURE
FirstName ← "Larry"
FOR Index ← 0 TO 9
OUTPUT Index
NEXT Index
CALL PrintIt
Initial ← Name[0]
RETURN Initial
ENDFUNCTION
INPUT FirstName
FirstNameInitial ← GetInitial(FirstName)
INPUT LastName
LastNameInitial ← GetInitial(LastName)
IF ForceUppercase
THEN
Initial ← UCASE(Name[0])
ELSE
Initial ← Name[0]
ENDIF
RETURN Initial
ENDFUNCTION
INPUT FirstName
Flow Chart
Definition:
A flowchart is a diagram that shows the sequence of actions or information needed for
tasks such as training, documenting, planning, and decision-making.
Symbols:
Totalling
Purpose: Calculate the sum of a list of numbers.