Decision 1: Algorithms Flashcards
What do the shapes of flow chart boxes mean? (3)
Squares with rounded edges - start/end
Squares - instructions
Diamond - decision
What is a trace table?
A table that records values from a flow chart, answering all decisions
What does the Euclidean algorithm do?
It finds the highest common factor of two numbers
What is bubble sort? (2)
A method of sorting numbers by comparing and switching adjacent numbers until the end of one pass is identical to the previous pass
One pass - every adjacent pair of numbers has been compared
What is quick sort? (3)
A method of sorting that uses the pivot (middle number) to move numbers into the correct order
The pivot - circled middle number (otherwise consistently choose left/right)
Fixed number - a boxed number that has been used as a pivot in a previous pass remains fixed
What is bin packing?
The process of fixing ‘boxes’ into ‘bins’ with a fixed size
How is the minimum number of bins needed for bin packing calculated?
Sum of box sizes / height of one bin
Bin Packing - First Fit
Fit the boxes in the order given, putting them in the first bin with enough space or adding a bin if there is no room in any
Bin Packing - First Fit Decreasing
Order the boxes in decreasing order, then use first fit
Bin Packing - Full Bin
Fill as many bins as possible, in any order, and then use first fit on the remaining boxes
What is an algorithm?
A finite sequence of step-by-step instructions carried out to solve a problem