Download presentation
Presentation is loading. Please wait.
1
Lecture 34 CSE 331 Nov 26, 2012
2
Online OH
3
Three general techniques
High level view of CSE 331 Problem Statement Problem Definition Three general techniques Algorithm “Implementation” Data Structures Analysis Correctness+Runtime Analysis
4
Greedy Algorithms Natural algorithms
Reduced exponential running time to polynomial
5
Divide and Conquer Recursive algorithmic paradigm
Reduced large polynomial time to smaller polynomial time
6
A new algorithmic technique
Dynamic Programming
7
Dynamic programming vs. Divide & Conquer
8
Same same because Both design recursive algorithms
9
Different because Dynamic programming is smarter about solving recursive sub-problems
10
Using Memory to be smarter
Pow (a,n) // n is even and ≥ 2 return t * t t= Pow(a,n/2) Pow (a,n) // n is even and ≥ 2 return Pow(a,n/2) * Pow(a, n/2) O(n) as we recompute! O(log n) as we compute only once
11
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 (30) (3) (2) (5) (10) Party! Exam study 331 HW Project Monday Tuesday Wednesday Thursday Friday
12
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
13
Today’s agenda Formal definition of the problem
Start designing a recursive algorithm for the problem
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.