feb 12
project
- discuss project assignment, and go over the options for problems
convex hull
points x[i], y[i] in two dimensions, 0 <= i <= N-1
Procedure
loop over pairs (i != j)
* Find (a,b,c) such that "a x + b y = c"
is line through points i and j.
* loop over other points k
Set sign = (a x[k] + b y[k] - c) for 1st k
Fail if same formula has other sign for other k's.
* If success, save that (i,j) as part of convex hull
Math details
- equation of line through (x1,y1) (x2,y2) is ...
a x1 + b y1 + c = 0
a x2 + b y2 + c = 0
- solve for (a,b,c). Hmm: too many variables.
- Set c=1 (Why is this OK?)
- Then we have a matrix equation to solve :
- Does this equation always have a solution? (No.) How do we deal with that?
knapsack and assignment problems
- discuss; make sure brute force approach is clear
start divide and conquer ?
- sums example: not always better
- merge sort - discuss why it's n * log(n)
- quicksort - assign for reading soon