Term 1 | Practical | Chapter 1 Flashcards
What is an algorithm?
an ordered list of steps for carrying out a task or solving a problem.
What are the criteria that an algorithm should have
● there must be a limited number of steps
● the steps must be:
easy to understand and follow
detailed and specific
clear and unambiguous
● each step should:
consist of a single task
be at the most basic level that cannot be broken into simpler tasks
● all repetitions must have clear ending conditions
● there must be at least one result (or output).
What are the 2 criteria you require to evaluate the quality of an algorithm?
● precision
● order
What does precision refers to in an algorithm
Precision refers to how accurately and reliably an algorithm solves a
problem. The more precise an algorithm is, the better it is at solving the
problem correctly regardless of the situation.
What does order refers to in an algorithm
Order refers to the total number of steps needed (including repeats) to complete an algorithm. The order
of an algorithm is usually shown as a mathematical formula based on the number of inputs.
What are the steps of creating a high quality algorithm
● Understanding the problem
● Defining the desired solution or output
● Defining the inputs
● Designing a set of steps to complete the task
● Testing the algorithm
● Updating the algorithm:
What is a flowchart?
A flowchart is a visual representation of an algorithm. It can be made up of five different elements
What are the 5 elements in a flowchart and their function?
Terminal Indicates the start and end of an algorithm.
Begin / End
Input/Output Shows when data is added to the algorithm or given to the user.
Instruction Gives an instruction that the algorithm must follow.
Decision Shows a decision (or condition) that affects the algorithm’s behavior.
Connector
Connects one element of the algorithm to the next element. Shows
the direction in which you move from one element to the next