2.2.2c - writing and following algorithms Flashcards
What is an algorithm?
A step-by-step procedure for solving a problem or task.
What is pseudocode?
An informal, human-readable description of an algorithm.
What is flowcharting?
A visual representation of an algorithm using symbols and arrows.
What is the purpose of a well-defined algorithm?
To ensure consistency and accuracy in solving problems.
What is the first step in writing an algorithm?
Understanding the problem and its requirements.
What is an algorithm’s complexity?
A measure of the algorithm’s efficiency in terms of time or space.
What is a sequence in an algorithm?
A series of steps executed in order.
What is a decision in an algorithm?
A step that leads to different actions based on conditions.
What is an iteration in an algorithm?
A loop that repeats steps until a condition is met.
What is the role of testing in algorithm design?
To ensure that the algorithm solves the problem correctly and efficiently.
What is a dry run?
Manually going through an algorithm step by step to check for correctness.
What is the purpose of debugging algorithms?
To find and fix errors that prevent the algorithm from working correctly.
What does an algorithm’s time complexity measure?
The number of steps an algorithm takes relative to the input size.
What does an algorithm’s space complexity measure?
The amount of memory used by the algorithm.
Why is following an algorithm important?
It ensures the problem is solved consistently and efficiently.
What is the difference between an algorithm and a program?
A program is an implementation of an algorithm.