Skip to Content
Grokking Algorithms
book

Grokking Algorithms

by Aditya Bhargava
May 2016
Intermediate to advanced
256 pages
5h 53m
English
Manning Publications
Content preview from Grokking Algorithms

Chapter 9. Dynamic programming

In this chapter

  • You learn dynamic programming, a technique to solve a hard problem by breaking it up into subproblems and solving those subproblems first.
  • Using examples, you learn to how to come up with a dynamic programming solution to a new problem.

The knapsack problem

Let’s revisit the knapsack problem from chapter 8. You’re a thief with a knapsack that can carry 4 lb of goods.

You have three items that you can put into the knapsack.

What items should you steal so that you steal the maximum money’s worth ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Grokking Algorithms, Second Edition

Grokking Algorithms, Second Edition

Aditya Bhargava
Algorithms: 24-part Lecture Series

Algorithms: 24-part Lecture Series

Robert Sedgewick, Kevin Wayne

Publisher Resources

ISBN: 9781617292231Publisher SupportOtherPublisher WebsiteSupplemental ContentErrata PagePurchase Link