paper 2 computational thinking
Ask user for an integer input
int(input()
When would you use a while loop?
When it is not known how many times iteration will occur.
while loop which will add 1 onto 0 until it reaches 8
number = 0
while number != 8:
number = number + 1
print ("The number is",number)
while loop
condition controlled
for loop
count controlled
count controlled meaning
you specify the number of times that you wish the iteration to be repeated
for loop, repeat 10 times until it reaches 5
for i in range(10):
if i == 5:
break
print(i)
MOD definition (%)
calculates the remainder of a division
iteration
The repetition of a block of statements within a computer program.
selection
the process of making a decision which result will decide which path it takes next
sequence
a set of instructions that follow on one from another
nesting
one programming construct within another
start/end
process
input/output
if
flow
Abstraction
Removing the unnecessary parts of a problem so that you only focus on the important parts
Decomposition
Breaking a complex problem down into smaller problems so that it is more manageable/easier to solve
Binary Search
A type of searching algorithm. In order to use a binary search the data set must be in order.
Linear Search
A type of searching algorithm. The data set does not need to be in order when using a linear search.
Sorting Algorithm
A type of algorithm used to sort a data set into a specific order
Bubble Sort
A type of algorithm used to sort a data set into a specific order. The data set is passed through, and two pieces of data are looked at in turn. The process does not stop until a pass is completed without moving any data.
Merge Sort
A type of algorithm used to sort a data set into a specific order. The data set it broken up into pairs. Each pair is reorganised in turn. Pairs are then merged together and reorganised. This process is repeated until the whole data set is merged and reorganised
Insertion Sort
A type of algorithm used to sort a data set into a specific order. A new, temporary list is created, and each piece of data is placed into the correct place in the new list.
Trace Table
Used to test an algorithm for logic errors by simulating the flow of execution.