Chapter 1 Flashcards
What is an algorithm?
A finite sequence of step by step instructions carried out to solve a problem
What shape shows start/end ina flow chart?
And oval
What shape shows an instruction ina flow chart?
Rectangle
What shape shows a decision in a flow chart?
Diamond
Name two types of sort
Bubble Sort
Quick sort
Describe a bubble Sort
Start at the beginning if the lost and compare adjacent items
If they are in order leave them
If they are not in order swap them
When you get to the end of the lost the final item will be in the right place
Repeat the steps until a pass is completed without swaps
Describe a Quick Sort
The midpoint of the list is the first pivot
Put all the items less than the II it on the left sid and all the ones more on the right side of the pivot
Repeat again with each sub list
When all the items have been pivots stop
What are the three bin packing algorithms?
First fit
First fit decreasing
Full bin
Describe the first fit algorithm
Take the items in the order given
Place each item in the first available bin
Describe the first fit decreasing algorithm
Sort the items into descending order
Apply the first fit algorithm
Describe the full bin packing algorithm
Use observation to find combinations that will fill a bin and a k these first
Any remaining ones are lacked using first fit
If an algorithm has order f(n) what factor will the run time increase by?
f(m)/f(n)