Algorithm
step by step structured recipe of calculations for solving a problem
Pseudocode
Commonly used to express algorithms
Resembles a high-level programming language - like Python
What does the speed of a search depend on?
Algorithm
What does the speed of an algorithm depend on?
Nature of the data
How it is stored
How many search operations we want to perform
Linear search
Simplest search
Iterate over all entries in a list/tuple/dictionary
Does not place requirements on the order of the data
Binary search
Used if we have a sorted list
Similarities to bisection
What are the two classic sorting algorithms
Bubble
Quicksort
Bubble sort
One of the simplest sorting algorithms
Iterate over values in an array, if neighbours wrong we swap them
What are the cons of bubble sort
Inefficient for large lists, but performs the task
Quicksort
“Divide and Conquer”
Recursive algorithm
Which one is faster: quicksort or bubble sort
Quicksort