Topic 1-Algorithms Flashcards
What is an algorithm?
An algorithms is a series of step by step instructions to complete a task.
What is abstraction?
Abstraction is removing any unnecessary details to focus on the relevant parts and make the problem more simple.
What is decomposition?
Decomposition is breaking down a complex problem into smaller, more manageable, subproblems. Each sub-solution can be combined to solve the problem.
What is pattern recognition?
Pattern recognition is finding cimilarities between problems that are decomposed to help us solve more complex problems with more efficiency.
Name an example of abstraction.
A tube map details tube lines, services and the stations but does not feature above ground landmarks or shops to make planning a journey easier, this means it is an example of abstraction.
Name an example of decomposition.
A bicycle is an example of decomposition as all of the complex details come together to make it rideable.
What is computational thinking?
Computational thinking is combining pattern recognition, algorithms, abstraction and decomposition to complete a task.
Name an example of computational thinking.
Cleaning your room.
What is an input?
Indicates a user will be inputting something.
What is an output?
Indicates that an output will appear on the screen.
What is a for iteration?
A counting iteration that has a defined set of loops. This means it is definite.
What are while and repeat until iterations?
They are indefinite.
What is a while loop?
Iteration with condition at start.
What is a repeat until loop?
Iteration with condition at end.
What is the difference between a while loop and a repeat until loop?
A while loop may never be executed however with a repeat until loop the code is always executed atleast once.
What are trace tables used for?
Used to check code/algorithms.
What are the pros and cons of a bubble sort?
+less storage space
-takes longer as it is one by one
What are the pros and cons of a merge sort?
+quicker
-more storage space
Explain the bubble sort?
Compares two pieces of data and switches them depending on which one has a greater value.
Explain the merge sort?
Divideand conquer technique that only checks half of the data.
Explain the linear search?
uses brute force to check every piece of data sequentially from left to right.
Explain the binary search?
Half n half method where the data is cut in half and one half is discarded and so on.
What are the pros and cons of linear search?
+good for smaller or unsorted data sets
-can take longer
What are the pros and cons of binary search?
+good for larger or sorted data sets
-can’t do unsorted data sets