Select a course.
arrow_back
2.1 Algorithms
infoWhy this? Algorithms are the step-by-step instructions that allow computers to solve problems. Every app, website and digital service relies on algorithms to function.
scheduleWhy now? Learning how to design and evaluate algorithms now helps develop logical thinking, problem-solving and planning skills that are valuable not only in Computer Science but across all areas of learning and employment.
neurologyYou need to know
- Abstraction reduces a problem by removing unnecessary detail and retaining the information needed to create a solution.
- Decomposition breaks a complex problem into smaller, manageable sub-problems that can be solved and tested separately.
- Algorithmic thinking involves defining a logical, ordered sequence of steps that solves a problem.
- Computational thinking uses abstraction, decomposition and algorithmic thinking together to define and refine problems.
- An input is data supplied to a system, a process is an operation performed on the data, and an output is the resulting information or action.
- A structure diagram shows how a problem is decomposed into smaller sub-problems and how those sub-problems are linked.
- An algorithm is a precise, ordered and finite sequence of instructions for solving a problem.
- Algorithms can be represented using pseudocode, flowcharts, an exam reference language or a high-level programming language.
- In a flowchart, a terminal represents the start or end, a parallelogram represents input or output, a rectangle represents a process, a diamond represents a decision, and a predefined-process symbol represents a subprogram.
- Flow lines in a flowchart use arrows to show the order in which instructions are executed.
- Selection chooses which instructions to execute according to whether a condition is true or false, while iteration repeats instructions while or until a condition is met or for a specified number of times.
- Nesting occurs when one selection or iteration structure is placed inside another selection or iteration structure.
- A syntax error occurs when code breaks the grammatical rules of a programming language and usually prevents the program from running or translating successfully.
- A logic error occurs when a program runs but produces an incorrect or unintended result because the algorithm or implementation is flawed.
- A trace table records how variables, conditions and outputs change as each instruction or iteration of an algorithm is executed.
- A linear search checks items one at a time until the target is found or every item has been checked, and it does not require the data to be sorted.
- A binary search requires sorted data and repeatedly compares the target with the middle item before discarding the half that cannot contain the target.
- A bubble sort repeatedly compares adjacent items and swaps them when they are in the wrong order until a complete pass requires no swaps.
- An insertion sort builds a sorted section by taking each new item and inserting it into its correct position within that section.
- A merge sort repeatedly divides a data set into smaller sections, then merges the sections in order to produce a sorted data set.
rocket_launchYou must be able to
- Apply abstraction to a problem by identifying essential information and excluding details that do not affect the solution.
- Decompose a problem into clearly defined sub-problems and represent their relationships using a structure diagram.
- Identify the required inputs, processes and outputs for a given computational problem.
- Create, interpret, complete and refine algorithms using pseudocode, flowcharts or a high-level programming language.
- Use the correct flowchart symbols and directional flow lines to represent inputs, outputs, processes, decisions, subprograms and terminals.
- Construct nested selection and iteration so that the control structures execute in the intended order.
- Identify syntax and logic errors in algorithms or code, explain their effects and suggest precise corrections.
- Create and complete a trace table by recording variable values, condition results and outputs in the correct execution order.
- Apply linear search, binary search, bubble sort, insertion sort and merge sort to data sets, showing each comparison, division, insertion, swap or merge as appropriate.
- Identify a standard searching or sorting algorithm from its code, pseudocode or exam reference language and justify the identification using its key steps.
Revision Quiz
trophy
Congratulations! You have completed the quiz.