0% found this document useful (0 votes)
2 views21 pages

Chapter 9 Algorithm Design and Problem Solving

Chapter 9 discusses algorithm design and problem-solving techniques, including Structured English, Flowcharts, and Pseudocode. Structured English provides a simple representation of programming statements, while Flowcharts visually depict solution flows, and Pseudocode offers a textual format for algorithms. The chapter includes examples of pseudocode for various problems and outlines the Bubble Sort algorithm for sorting integers.

Uploaded by

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

Chapter 9 Algorithm Design and Problem Solving

Chapter 9 discusses algorithm design and problem-solving techniques, including Structured English, Flowcharts, and Pseudocode. Structured English provides a simple representation of programming statements, while Flowcharts visually depict solution flows, and Pseudocode offers a textual format for algorithms. The chapter includes examples of pseudocode for various problems and outlines the Bubble Sort algorithm for sorting integers.

Uploaded by

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

Chapter 9 Algorithm Design and Problem Solving

Thursday, November 13, 2025 4:05 PM

Algorithm :
➢ Structure English: is the simple representation of programming
statements by using the English sentences.
➢ This method is use to refine the solution roughly before moving
Quick Notes Page 1
➢ Structure English: is the simple representation of programming
statements by using the English sentences.
➢ This method is use to refine the solution roughly before moving
toward the Flowchart or pseudocode.
➢ Each solution step can be named as Step 1 Step 2 or etc. or numbered
to find the relevant part.

Flowchart: is the diagrammatical representation of solution to give the


visual display to the customer. That will help to understand the flow of
solution modules.
➢ Flowchart uses the different symbols to present the solution.
Pseudocode: is the textual representation of solution it include the
given format for the use of structures(Control, Selection, Programming
Structures).
➢ Each structure have their own syntax format and the its variable are
identified as Identifiers.

Identifiers: is the other name of variables that store the value of input
according to the data type.

Structure English codes:


Q: Get the two numbers from user. If the first number is greater than 5
then add the both numbers otherwise subtract the both numbers.
1. Take the two numbers as integer
2. Compare the both numbers
3. IF number 1 is greater than number 2
4. Then add the both numbers and save the result in Sum
5. Otherwise Save the subtraction result of the both numbers
6. Display the result according to condition status

Q2: Take the marks of 20 students and display their total and average.
Q3: Make the function to calculate the zakat on the given crop amount.
The zakat value is 5 % is the crop was produced by artificial resources
otherwise the crop value is 10%.

Flowchart:
Quick Notes Page 2
otherwise the crop value is 10%.

Flowchart:

Quick Notes Page 3


Quick Notes Page 4
Quick Notes Page 5
x

Quick Notes Page 6


Quick Notes Page 7
Quick Notes Page 8
Quick Notes Page 9
Quick Notes Page 10
The program should ask the user:
"What is 7 × 8?"
The loop continues until the user enters the correct answer.
When the correct answer is given, the program should display:
"Correct! Well done."
Write the full pseudocode using a REPEAT…UNTIL loop.
Quick Notes Page 11
Write the full pseudocode using a REPEAT…UNTIL loop.

Quick Notes Page 12


Quick Notes Page 13
Quick Notes Page 14
Quick Notes Page 15
Quick Notes Page 16
Quick Notes Page 17
Quick Notes Page 18
Quick Notes Page 19
Write a program that sorts a list of integers using the Bubble Sort algorithm, implemented inside a function or
procedure. Your program should meet the following requirements:
1. The program should accept a list of integers from the user (at least 10 numbers).
2. Create a function/procedure called BubbleSort that:
○ Takes the list as a parameter.
○ Sorts the list in ascending order using the Bubble Sort algorithm.
○ Returns the sorted list.
3. The main program should:
Call the BubbleSort function.
Quick Notes Page 20
○ Call the BubbleSort function.
○ Display the sorted list.
○ Display the number of swaps made during sorting.

Quick Notes Page 21

You might also like