Lecture Notes for CS 512, Algorithm Design
7 October 1999
These are provisional lecture notes, expect changes.
- going from algorithm to order notation - many ways
- algorithm, mathematical model (that is, function), order approximation
- knuth
- subsidiary model - computation model; ram, mix
- algorithm, order notation - structural analysis
- structural analysis - algorithm structure
- assign behavior to smaller units, then combine units following
algorithm structure to find behavior of larger units.
- statements
- usually O(1), but know your data structures - eg a[i]
vs. put_queue(q, i) vs. put_priority_queue(q, i)
- statement sequence - s1 ; s2
- s1 is O(f), s2 is O(g), so s1 ; s2 is O(f) + O(g)
- but what is O(f) + O(g)?
- treat O(f) as a set of functions, pick a representative
function and apply the definition of big-oh.
- plus, max, constant
- example: i <- 1 ; heapify(h, i)
- loops - do b s od
- s gets executed some number of times - asymptotically bound the
number of times
- O(f)*O(g) - what is that?
- implicit, and occasionally troublesome, assumption - the loop itself
does constant work per iteration.
- if statement - if b s1 or b s2 fi
- fine points
- what is the input - what's n?
- making the assumptions - best, average, worst
- what's the output - what are we measuring; memory accesses,
comparisons, swaps and so on
This page last modified on 7 October 1999.