Computational Thinking revision guide

By Interwoven Maths

Practise Computational Thinking View all questions Back to Computer Science

Everything you need to know

Computational thinking is the set of habits used to turn a problem into something a computer can solve.

Abstraction

Abstraction means leaving out detail that does not matter, so that a real situation can be modelled. A model of a car park records how many spaces are free, not the colour of each car.

Testing a model

A model is useful only if it behaves like the thing it stands for. Trying it against known cases shows whether it does, and where it has left out something that matters.

Algorithms

An algorithm is a set of ordered steps that solves a problem. It must be unambiguous and must stop.

Algorithms can be written as pseudocode, which is independent of any language, or drawn as a flowchart, in which a diamond is a decision, a rectangle a process, a parallelogram an input or output, and an oval the start or end.

A trace table records the value of each variable at each step, which shows what an algorithm does and where it goes wrong. A logic error lets a program run but produces the wrong answer.

Comparing algorithms

Two algorithms can solve the same problem with different amounts of work. A linear search checks each item in turn and works on any list. A binary search repeatedly halves a list but needs it sorted first.

A sorting algorithm puts data in order. One pass of a bubble sort compares each adjacent pair and swaps those in the wrong order.

Efficiency compares how much time or memory each algorithm needs.

Programming constructs

Three constructs build any program. Sequence runs statements in order. Selection chooses a path using a condition, written with if. Iteration repeats statements: a for loop a set number of times, a while loop as long as a condition holds.

A variable is a named store whose value can change. A condition evaluates to true or false.

Subroutines

A subroutine is a named, reusable section of an algorithm. Writing a task once and calling it wherever it is needed shortens a program and makes it easier to change.

Boolean logic

AND is true only when both inputs are true, OR when at least one is, and NOT reverses a value.

Back to Computational Thinking practice ยท View all Computational Thinking questions