The steps you take to find the best solution to a complex problem
Three Key Techniques for Computational Thinking
DECOMPOSITION - breaking a complex problem down into smaller problems and solving each one individually
ABSTRACTION - picking out the important bits of information from the problem, ignoring the specific details that don't matter
ALGORITHMIC THINKING - a logical way of getting from the problem to the solution
If the steps you take to solve a problem follow an algorithm then they can be reused and adapted to solve similar problems in the future
Computational thinking in real-life
Deciding which film to watch at the cinema with your family
Decomposition
Breaking down a complex problem into smaller problems and solving each one individually
Abstraction
Picking out the important bits of information from the problem, ignoring the specific details that don't matter
Algorithmic thinking
A logical way of getting from the problem to the solution
Computer scientists rely on decomposition, abstraction and algorithmic thinking to help them turn a complex problem into small problems that a computer can help them to solve
Decomposition and abstraction are important skills that you'll need to develop if you want to succeed in your exams
Pseudocode
Not an actual programming language but it should follow a similar structure and read like one (roughly)
Pseudocode is quick to write and can be easily converted into any programming language
There are different ways to write pseudocode - they are all equally correct as long as the person reading the code can follow it and understand what you mean
Pseudocode should be more 'wordy' than a formal programming language, but easier to understand
Even though pseudocode isn't a formal programming language you still need to make sure it's readable, easy to interpret and not too vague
Pseudocode is a great way to write an algorithm in the exam if you're not told how to give your answer
Flowchart
A way to show an algorithm using different shapes to represent different commands
Different shapes used in flowcharts
Decision (diamond)
Start/Stop (rounded corners)
Inputs/Outputs (parallelogram)
Sub Programs (reference other flowcharts)
Processes (rectangle)
Flowcharts for different algorithms
Calculating salary after 10% increase
Checking password validity
Linear search
Flowcharts should show the general flow of an algorithm without going into too much detail at each step
Everything covered in the programming section will work slightly differently in different programming languages, but the principles are the same
Five main data types in programming languages
Integer
Real (or float)
Boolean
Character
String
Integer
Whole numbers only
Real (or float)
Numbers that have a decimal part
Boolean
Can only take one of two values, usually TRUE or FALSE
Character
A single letter, number, symbol
String
Used to represent text, it is a collection of characters
Each data type is allocated a different amount of memory
Using the correct data types makes code more memory efficient, robust (hard to break) and predictable
Weakly typed language
Will try to convert data types to avoid errors, however this can lead to unpredictable results
Strongly typed language
Won't try to convert data types and so will produce more errors but more predictable results
Casting
Using functions to manually convert between data types
The integer 1, the real 1.0 and the strings "1" and "1.0" are all different
Basic arithmetic operators
Addition (+)
Subtraction (-)
Multiplication (*)
Division (/)
Exponentiation (^, **)
Quotient (DIV)
Remainder (MOD, %)
Dividing integers might behave oddly in some programming languages, e.g. 5/2 may give the answer 2 instead of 2.5</b>
Operators
Special characters that perform certain functions
Basic Arithmetic Operators
Addition +
Subtraction -
Multiplication *
Division /
Exponentiation ^ or **
Quotient DIV
Remainder (modulus) MOD or %
Arithmetic operators
Take two values and perform a maths function on them
Addition, subtraction, multiplication and division operators do what you'd expect
The exponentiation operator is used to raise a number to a power
The DIV operator returns the whole number part of a division and the MOD operator gives the remainder
Dividing integers might behave oddly in some programming languages, e.g. 5/2 may give the answer 2 instead of 2.5
Computers follow the rule of BODMAS (Brackets, Other, Division, Multiplication, Addition & Subtraction)