240 likes | 254 Views
Explore greedy algorithms, dynamic programming, problem-solving techniques, and analysis for optimizing runtime. Discover the power of recursion and memory utilization in algorithm design.
E N D
Lecture 34 CSE 331 Nov 18, 2011
HW 9 due today Q1, Q 2 and Q3 in separate piles I will not take any HW after 1:15pm
HW related stuff Solutions to HW 9 at the end of the lecture Graded HW 8 will be available for pickup form Monday No HW handed out today!
Lecture on Monday I’ll be out of town My student Swapnoneel will cover for me
A preview of what I’m up to List Decoding: The master of disguise Practice talk: 3:15pm, Friday, Commons 9
Dividing up P R Q First n/2 points according to the x-coord
Recursively find closest pairs R Q δ = min (blue, green)
Pruning out some points δ δ >δ R Q > δ > δ δ = min (blue, green)
All we have to do now δ δ R Q S Figure if a pair in S has distance <δ δ = min (blue, green)
Kickass Property Lemma If s ≠ s’ in S have d(s,s’) ≤ δ, then s and s’ are within 15 positions of each other in Sy
Today’s Agenda Prove the kickass property lemma
HW 9 due today Q1, Q 2 and Q3 in separate piles I will not take any HW after 1:15pm
High level view of CSE 331 Problem Statement Problem Definition Three general techniques Algorithm “Implementation” Data Structures Analysis Correctness+Runtime Analysis
Greedy Algorithms Natural algorithms Reduced exponential running time to polynomial
Divide and Conquer Recursive algorithmic paradigm Reduced large polynomial time to smaller polynomial time
A new algorithmic technique Dynamic Programming
Same same because Both design recursive algorithms
Different because Dynamic programming is smarter about solving recursive sub-problems
Using Memory to be smarter Pow (a,n) Pow (a,n) // n is even and ≥ 2 // n is even and ≥ 2 t= Pow(a,n/2) return Pow(a,n/2) * Pow(a, n/2) return t * t O(n) as we recompute! O(logn) as we compute only once
End of Semester blues Can only do one thing at any day: what is the optimal schedule to obtain maximum value? Write up a term paper (10) Party! (2) Exam study (5) 331 HW (3) Project (30) Monday Tuesday Wednesday Thursday Friday
Previous Greedy algorithm Order by end time and pick jobs greedily Greedy value = 5+2+3= 10 Write up a term paper (10) OPT = 30 Party! (2) Exam study (5) 331 HW (3) Project (30) Monday Tuesday Wednesday Thursday Friday
Today’s agenda Formal definition of the problem Start designing a recursive algorithm for the problem