What is an algorithm?
A finite sequence of step-by-step instructions carried out to solve a problem
Name 2 methods of sorting unordered lists
2. Quick Sort
What are the steps to the bubble sort algorithm?
What are the steps to the quick sort algorithm to sort a list in ascending order?
What are the 3 bin-packing algorithms?
What is the state of the order of a list for the first-fit algorithm?
Items are in the order they are given
What is the state of the order of a list for the first-fit decreasing algorithm?
Requires the items to be in descending order before applying algorithm
What is the state of the order of a list for the full-bin algorithm?
Order does not matter
What are the steps to the first-fit algorithm?
2. Place each item in first available bin that can take it, starting from Bin 1 each time.
What are the steps to the first-fit decreasing algorithm?
2. Apply first-fit algorithm to this list
What are the steps to the full-bin algorithm?
What is the advantage and disadvantage of using first-fit algorithm?
Advantage: Quick to implement
Disadvantage: Unlikely to lead to good solution
What are the advantages and the disadvantage of using the first-fit decreasing algorithm?
Advantages: Easy to implement and usually get a fairly good solution
Disadvantage: May not get optimal solution
What is the advantage and disadvantage of using the full-bin algorithm?
Advantage: Usually get a good solution
Disadvantage: Difficult to do, esp. with many awkward numbers
What is the order of an algorithm?
A function of its size
If an algorithm has an order of f(n), what factor will the algorithm’s run time increase by if the size of the problem n to m?
f(m) / f(n)
When the size of a problem is increased by a factor of k, how long does it take a linear order algorithm to complete?
k times as long
When the size of a problem is increased by a factor of k, how long does it take a quadratic order algorithm to complete?
k squared times as long
When the size of a problem is increased by a factor of k, how long does it take a cubic order algorithm to complete?
k cubed times as long