2.1 Algorithms Flashcards
What is abstraction and decomposition
Abstraction - removing unnecessary information, e.g. the London Tube map
Decomposition - the process of breaking down a task into a sequence of simpler subtasks
How do you write pseudocode
Basically writing in python but if you forget how to do something, you can just write it how you would say it, e.g. ** = ^
What does an arrow mean in a flowchart
Flow line - shows the way to go in a flowchart
What does an oblong mean in flowcharts
Terminal - the start and the end of a process
What does a rectangle mean in a flowchart
Process - a set of operations that can change a value
What does a diamond mean in a flowchart
Decision - which path the flow line should follow
What does a parallelogram mean in a flow chart
Input/output - ask for the user to enter something or want to print something
What does a square with thin rectangles on the side mean in a flowchart
Sub process - a function/procedure
What are the searching algorithms
Linear - compares each value with the value you are looking for
Binary - splits the list in half, discards the half which wont have the value you are looking for
When would you use linear search over binary search and vice versa
Linear:
For smaller lists
Values can be in any order
Easier to code
Binary:
For larger lists
Values must be in order
Harder to code
What are the sorting algorithms
Bubble - it will compare the values until the highest value is at the top of the list
Merge - split the list into halves until the values are separate. The values are put together in the parts they were split into and sorted
Insertion - there is a sorted and unsorted and a value in the unsorted list and is compared to the values in the sorted list and it is put into its right place