Lecture Notes for CS 512, Algorithm Design
25 September 1999
These are provisional lecture notes, expect changes.
- searching
- problem - find an item in an array of items
- linear search - simple and efficient for small n
- improve the search by eliminating more than one item per comparison
- sorting the array leads to a binary search
- pure
- cyclic
- matches
- a match is when a[i] = i
- increasing intervals
- stuttering subsequences
- bisection, bolzano's method
- do better by elimiating more than half on each comparison
- interpolation sort - guess the likely location
- more complicated, a small improvement over a large improvement
- sorting - ascending, descending order
- problem - how do you sort the array; in place, in situ; key
- order n sorts
- bucket sorts - a small number of buckets
- repeated bucket sorts on pieces of the key - radix sort
- right-to-left, radix exchange
- left-to-right, straight radix
- insertion and selection sort - order n^2 sorts
- order n log n sorts
- mergesort - divide and conquer; extra storage
- quicksort - be a bit smarter on the divide part; n^2 worst case
behavior, n log n average case behavior; smallest division size; good
execution characteristics
- heapsort - build and rebuild the heap, picking off the top element
each time
- creating the heap in situ; top down and bottom up
- lower bound
- order statistics - median
- maximum, minimum, max and min - exploit all information
- k-th smallest - back to quicksort.
- majority
This page last modified on 25 September 1999.