dynamic programming
play

Dynamic programming Topics for this week: - backtracking revisited: - PowerPoint PPT Presentation

[Week 9] Dynamic programming Topics for this week: - backtracking revisited: a brute-force technique that finds a solution by trying all possibilities (usually VERY SLOW) - sometimes can be remedied by storing pre-computed values: called


  1. [Week 9] Dynamic programming Topics for this week: - backtracking revisited: a brute-force technique that finds a solution by trying all possibilities (usually VERY SLOW) - sometimes can be remedied by storing pre-computed values: called dynamic programming - comparing the time complexities: dyn-prog is usually very fast

  2. Problem: Job Scheduling with Pay You are a tile installer who has many jobs to choose from. Every job has a start time, finish time, and the pay you get for doing the job. You want to take those non-overlapping jobs that maximize your pay. Example: repairing old tiles, 8-10am, $200 grout sealing, 11-11:30am, $50 installing new tiles, 9am-12pm, $400

  3. Problem: Job Scheduling with Pay Greedy approaches: - Do the greedy strategies from last quarter work ? - What about a strategy that takes the most expensive job first, removes overlapping jobs, and continues with the same approach ?

  4. Problem: Job Scheduling with Pay Backtracking through all possible sets of non-overlapping jobs. [This is also called exhaustive enumeration.] Pseudo code:

  5. Problem: Job Scheduling with Pay A stack-frame diagram of the enumeration pseudo code: Time complexity:

  6. Problem: Job Scheduling with Pay A dynamic programming approach: Time complexity:

  7. Problem: Job Scheduling with Pay Tracing a more interesting example: Testing:

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend