Chapter 1 (Algorithms) Flashcards
Prim’s algorithm, order?
Cubic
Kruskal’s algorithm, order?
Cubic
Bubble sort, order?
Quadratic
What’s an algorithm
A set of specific set of finite instructions for carrying out a procedure or solving a problem (usually terminate at one point).
Curved rectangular box meaning?
Start/ End
Rectangle box meaning?
Process (an instruction)
Diamond meaning?
Decision
How can you tell when a quick sort list of numbers are in order
Once every number has become a pivot (no more changes are made)
What do you do if the lower bound is not an integer?
Round up to the next whole number
First fit algorithm:
Take the items in the order they’re given, place each item in the first available bin that can take it. Start with bin one each time
Advantages and Disadvantages of the first fit bin algorithm:
Quick
Not likely to lead to a good solution
First fit decreasing algorithm:
Record the items so they’re in decreasing order
Apply the first fit algorithm to this recorded list
Advantages and disadvantages of the first fit decreasing algorithm:
Usually get fairly good solutions
Easy to do
You may not get the optimum solution
Full bin packing:
Use observation to find combinations of items that will fill a bin. Any remaining is packed using first fit algorithm.
Advantages and Disadvantages of Full bin packaging:
Good solution
Takes a long time