9.2 AlgDesign.algorithms incompl Flashcards
What is Structured English in algorithm design?
A method of showing logical steps in an algorithm using straightforward English words for commands and mathematical operations.
What is a flowchart?
A diagrammatic representation of an algorithm, using symbols and flow lines to show the steps and their order.
What is an algorithm?
An ordered set of steps to be followed for completing a task.
What is pseudocode?
A representation of the logical steps in an algorithm using keywords, meaningful identifiers, and mathematical operators without adhering to a specific programming language’s syntax.
What is stepwise refinement?
The practice of breaking down a larger problem into smaller, manageable parts, and further subdividing them as needed.
What are three common methods for writing algorithms?
- Structured English: Logical steps in plain English.
- Flowchart: Diagrammatic representation of the steps.
- Pseudocode: Detailed logical steps with keywords and operators.
What are the key features of Structured English?
- Uses simple English commands.
- Represents logical steps clearly.
- Often includes numbering for each step.
Why are flowcharts effective in algorithm design?
They visually represent the structure of an algorithm, showing the sequence and relationships between steps.
How does pseudocode help in programming?
- Provides sufficient detail for writing programs in high-level languages.
- Uses meaningful names and logical steps.
- Avoids the syntax constraints of specific programming languages.
Example of Structured English Algorithm:
1 Ask for the number of values
2 Loop that number of times
3 Enter a value in the loop
4 Add the value to the total in the loop
5 Calculate and output the average
How is each step in a pseudocode algorithm typically written?
Each line of pseudocode represents a single step in the algorithm.
How should identifiers in pseudocode be written?
- Use meaningful names, such as
Name
for a person’s name. - Identifiers should only contain characters A–Z, a–z, and 0–9.
- Start identifiers with a letter.
- They are case-insensitive.
What can be used to track identifiers used in pseudocode?
A pseudocode table, with the Identifier name and Description for each identifier. This helps maintain clarity and organisation.
How do you input a value in pseudocode?
Use the INPUT statement:
Syntax:INPUT <Identifier>
Example: INPUT StudentName
How do you output a message, value, or combination in pseudocode?
Use the OUTPUT statement:
Syntax: OUTPUT <…>
Examples:OUTPUT "You have made an error”
OUTPUT StudentName
OUTPUT "Student name is ", StudentName