Algorithms Flashcards
algorithm
finite sequence of operations for carrying out a procedure or solving a problem
what must an algorithm be?
- unambiguous
- deterministics
- finite
how can algorithms be communicated?
flowchart or pseudocode
pass
worked through the instructions once
efficiency
using fewer operations
pseudocode
concise instructions that structure a computer code
slack variables
non negative statements equivalent to inequalities in standard form
size
measure of complexity, likely to be the number of the elements in the list
complexity
efficiency in relation to the size of the problem
which is more efficient nested or expanded form?
nested method, lower complexity O(n)
first fit algorithm
first bin that has enough space for it
first fit decreasing algorithm
order from largest to smallest and apply the first-fit method to it
full bin strategy
makes all the bins as full as possible, logical and no algorithm
heuristic
efficient solution, but not always optimal
how do you carry out quick sort algorithm
1) first value in the list is the pivot, write down values in same order which are smaller and larger than pivot
2) repeat on each sublist