1/10
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
Merge sort steps
Repeatedly divide list in half until each item is in own list
Take two lists & start with first item in each
Compare two items
Insert lowest item into new list, move to next item in list it was taken from
Repeat steps 3 & 4 until all items from one of the list are in the new list
Append all the items from that list that still contains items to the new list
Replace two adjacent lists with new list
Repeat from step 2 until all adjacent lists have been compared
Repeat from step 2 until only one list remains
Quick sort
More efficient than merge sort - less memory
Better for larger data sets & ideal for parallel processing where divide & conquer can be used
Quick sort steps
Set pointer to first & last item in list
While first pointer ≠ second pointer:
If item at pointers in wrong order, swap order & pointer
Move first pointer on item towards second pointer
Repeat from step 1 on list of items to left of pointer
Repeat from step 1 on list of items to right of pointer
Dijkstra
Finds shortest path between one node & all other nodes on weighted graph
Type of breadth-first search
Doesn’t work on edges with negative weight values
Dijkstra steps
Set initial distance from starting values for all nodes
For each node in graph
Find node with shortest distance from start that has not been visited
For each connected node that has not been visited
Calc distance from start
If distance from start is lower that current recorded distance from start
Set shortest distance too start of connected node to newly calculated distance
Set previous node to be current node
Mark node as visited
Start from goal node
Add previous node to start of list
Repeat from step 5 until node reached
Output list
Admissible
Used to describe a heuristic that is sensible
A* steps
Set initial g & f values ( g: from start, f: g + h) for all nodes in graph
Until goal node visited:
Find node with lowest f value that has not been visited
For each connected node
Calc relative distance from start by adding edge value & heuristic
If distance from start + heuristic is lower than current recorded f value
Set f value of connected node to newly calculated distance
Set previous node to be current node
Set previous node as visited
Start from goal node
Add previous node to start of list
Repeat from step 3 until start node reached
Output list
Time & memory complexity
How time scales as data size increases
How memory used scales as data size increases
Big O notation
Remove all terms except one with largest factor order
Remove any constants
Search algorithm complexity

Sorting algorithm complexity
