Define a linear search
Finds an item in a list by checking each item in turn
What are the key points of a linear search?
What are the advantages of a linear search?
Easy to implement
Works on ordered or unordered lists
Easy to add items
What are the disadvantages of a linear search?
Usually most inefficient on longer lists
Define a binary search
An algorithm for finding an item in a sorted list.
Starts at the middle and repeatedly divides the list containing the item in half
What are the key points of a binary search?
What are the advantages of a binary search?
Efficient
Suitable for large data sets
What are the disadvantages of a binary search?
Only works on ordered lists
Slow to add items, as they must be placed in the right place
Define a bubble sort
Orders a list of items by comparing and swapping pairs of items.
It ‘bubbles’ the smallest/largest number to the ends
How does a bubble sort work?
What are the advantages and disadvantages of a bubble sort?
Advantage: works well on small lists
Disadvantage: slow to work
Define an insertion sort
Slots each item into the correct position in a data set
How does an insertion sort work?
What are the advantages and disadvantages of an insertion sort?
Advantage: works well on small lists
Disadvantage: slow to work
Define a merge sort
Uses ‘divide and conquer’ to quickly sort data.
Creates multiple sub-problems, which are each solved individually before being re-joined.
How does a merge sort work?
Define a quick sort
Sorts a set of data at a high speed using ‘divide and conquer’.
It creates sub-programs which are solved individually then combined.
A pivot value will be chosen to compare the items to when dividing the list.
How does a quick sort work?
Define the ‘Dijkstra’s Shortest Path algorithm’
Finds the shortest distance between the starting node and target node using a weighted tree
Define the ‘A* algorithm’
Finds the shortest path between two vertices on a weighted tree using heuristics. Won’t consider every vertex
What are the advantages and disadvantages of Dijkstra’s Shortest Path?
Advantage:
Finds the shortest time to a location
Disadvantage:
Every vertex must be investigated
What are the advantages and disadvantages of the A* algorithm?
Advantages:
Optimal in regards to efficiency
Works well for complex problems
Disadvantages:
The speed of execution is dependant on the heuristic accuracy
Can have complexity problems
How is the Dijkstra’s Shortest Path algorithm carried out?
How is the A* algorithm carried out?