Please enable JavaScript.
Coggle requires JavaScript to display documents.
Algorithms and Programming contructions - Coggle Diagram
Algorithms and Programming contructions
Successful Algorithms
A successful algorithm must be correct and efficient
Variable Identifier
A unique string representing the name of the variable
Loop Counter
It is a process where you set the counter to a number and each time you repeat you add one to a counter and check whether the counter has reached the maximum level
Algorithm
A step by step set of instructions used to solve a problem or carry out a task
Process
The formula to do something
Selection
A question is asked or a condition is checked
Flowchart symbols
Line - An arrow represents control passing between the connected shapes
Process (a rectangle) - Represents something being performed or done
Sub routine (a rectangle with two lines at the sides) - Represents a sub routine call that will relate to a separate, non-linked flowchart
Input/output (parallelogram) - Represents the input or output of something into or out of the flowchart
Decision (diamond) - Represents a decision (yes/no or true/false) that results in 2 lines representing the different possible outcomes
Terminal - (oval) - Represents the 'start' and 'end' of the process
Pseudocode
Writing out the algorithm without worrying about syntax.
Quick to write. Needs to be easy to understand/similar to the code it will be written in
Sequence
The order in which tasks are to be carried out
Iteration
Repetition a set number of times or until a condition is met
Flowchart
A flowchart is used to represent an algorithm
Output
Give information to the user
Count Controlled Loop
(Definite Iteration)
Repeating an action a set number of times
Condition Controlled Loop
(Indefinite Iteration)
Keep repeating an action until it meets a condition
Input
Get information from the user
Programming Constructs
The parts of an algorithm, sequence, selection and iteration
Variable
A named data value that can change while the programme is running
If Statement
An if statement sees if an expression is true or false if true the program will continue, if false then it will either move on to an elif or an else, an if is always checked.
Infinite loops
They go on repeating and never stop, some are intentional like checking the temperature over and over again forever. But most infinite loops are unintentional mistakes.
FOR NEXT loop
A count controlled loop where it the code will be performed however many times you tell it to: for count in range(3):will perform it 3 times
Assigning A Value To A Variable
To associate a specific piece of information with a name
Reserved Words
Words used by the programming language that you can’t use to name a variable: If, print
Switch/Case
Switch case is another way of writing if statements, python doesn’t use it but you may see it in pseudocode in the exam. (update - python use an equivalent called match case)
Bidmas
Computers follow the rule of BIDMAS (), powers, /, *, +, -. Check differences from pseudocode!
Constants
A set data value that does not change
π r² = the area of a triangle. π does not change but r does
DO loop
DO WHILE loops function in the same way as REPEAT UNTIL loops, with the WHILE condition being tested at the end of the loop
Boolean Operators
Are used to check multiple conditions at a time, and=both conditions must be true. or=at least one condition must be true
Relational/
Comparative Operators
== is equal to, != is not equal to, < is less than, > is greater than, <=is less than or equal to, >=is greater than or equal to. They are used to compare two or more variables
Nested If Statements
An if statement inside another if statement
Arithmetic Operators
Takes 2 values and performs a maths function on them.
+, -, *, /.
Comments
A readable explanation or annotation in the code of a computer program
WHILE loop
A condition controlled loop where it will perform the code until a certain outcome is reached: while num ==10: will repeat until num does not equal 10
Random number generation
A number generated at random(more or less)
Nested loops
This is a loop inside another loop