1: Algorithms & Graph Theory Flashcards
Bubble Sort Algorithm (1:2, 3)
- Start at the beginning of the working list and move from left to right, comparing adjacent items
a) If they are in order, leave them
b) If they aren’t in order, swap them - When you get to the end of the working list, the last item will be in its final position. Remove this item from the working list
- If you have made some swaps in the last pass, repeat steps 1 & 2
- When a pass is completed without any swaps, the list is in order
Quick Sort Algorithm (6)
- Choose item at the midpoint of the list to be the first pivot
- Write down all the items that are less than the pivot, keeping their order in a sub-list
- Write down the pivot
- Write down the remaining items in a sub-list
- Repeat steps 1 to 4 for each sub-list
- When all the items have been chosen as pivots, stop
First-Fit Algorithm (2)
- Take the items in the given order
2. Pack each item in the first available bin that can take it, starting from bin 1 each time
First-Fit Algorithm +/- (2)
+ Quick and easy to implement
- Not likely to lead to a good solution
First-Fit Decreasing Algorithm (2)
- Sort the items into descending order
2. Apply the first-fit algorithm on the reordered list
First-Fit Decreasing Algorithm +/- (3)
+ Usually get a fairly good solution
+ Quick and easy to implement
- May not get an optimal solution
Full-Bin Method (2)
- Use inspection to find combinations of items that will fill a bin and pack these items first
- Pack any remaining items using the first-fit algorithm
Full-Bin Method +/- (2)
+ Usually get a good solution
- Difficult to do, especially when the numbers are plentiful and awkward
Vertex / Node
Point on a graph
Edge / Arc
Line segment joining two vertices
Weight
Number associated with an edge
Weighted Graph / Network
Graph with weighted edges
Vertex Set
List of vertices
Edge Set
List of edges
Subgraph
Part of an original graph, all of whose vertices and edges belong to the original graph