For Monday Read chapter 10, section 4 Chapter 10, exercise 10 - - PowerPoint PPT Presentation

for monday
SMART_READER_LITE
LIVE PREVIEW

For Monday Read chapter 10, section 4 Chapter 10, exercise 10 - - PowerPoint PPT Presentation

For Monday Read chapter 10, section 4 Chapter 10, exercise 10 Research Paper Any questions? Program 5 On-Line Strategies Next Fit First Fit Best Fit Off-Line Strategies First Fit Decreasing Best Fit Decreasing


slide-1
SLIDE 1

For Monday

  • Read chapter 10, section 4
  • Chapter 10, exercise 10
slide-2
SLIDE 2

Research Paper

  • Any questions?
slide-3
SLIDE 3

Program 5

slide-4
SLIDE 4

On-Line Strategies

  • Next Fit
  • First Fit
  • Best Fit
slide-5
SLIDE 5

Off-Line Strategies

  • First Fit Decreasing
  • Best Fit Decreasing
slide-6
SLIDE 6

Divide and Conquer

  • Basic Concept

– Break a problem into pieces – Solve the problem for each piece – Combine the solutions to create the solution for the entire problem

  • Recursion

– The divide and conquer concept is recursive – Implementations of divide and conquer algorithms may or may not be recursive

slide-7
SLIDE 7

Finding a Counterfeit Coin

slide-8
SLIDE 8

Familiar Divide and Conquer Algorithms

  • What algorithms have we looked at that fit

this type?

slide-9
SLIDE 9

Familiar Divide and Conquer Algorithms

  • Quicksort
  • Mergesort
  • Binary Search
  • Permutations
  • Towers of Hanoi Solution
slide-10
SLIDE 10

Divide and Conquer Examples

  • Finding max-min
  • Closest two points
  • Selection
slide-11
SLIDE 11

Dynamic Programming

  • Related to divide and conquer
  • We want to build solutions from partial

solutions

  • However, our partial solutions may overlap
  • Rather than re-computing the partial

solutions, we want to compute them once

  • Bottom-up
slide-12
SLIDE 12

Fibonacci Numbers

  • Recursive solution
  • Better to use iterative solution and record

partial solutions

slide-13
SLIDE 13

Making Change

  • With standard denominations, we can use a

greedy algorithm to make change in the fewest number of coins

  • What if denominations are 1, 4, and 6
  • Greedy algorithm doesn’t work
  • But we can use partial solutions
slide-14
SLIDE 14

Basic Dynamic Programming

  • Find and record optimal solutions to the

smallest subproblems

  • From those solutions, compute optimal

solutions to the next-smallest subproblems

  • Continue until solution is computed to the

complete problem

slide-15
SLIDE 15

Principal of Optimality

  • Optimal solution must be based on optimal

partial solutions

slide-16
SLIDE 16

All Shortest Paths

  • Floyd’s algorithm is a dynamic

programming algorithm

  • We keep track of best path known thus far.
slide-17
SLIDE 17

Matrix Multiplication

slide-18
SLIDE 18

Optimal Binary Tree