0% found this document useful (0 votes)
12 views

6 Dynamic Programming

This document provides an introduction to dynamic programming including its definition, characteristics, patterns including memoization and tabulation, and examples of each. Dynamic programming solves problems by breaking them into subproblems and storing the results to build up the overall solution.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

6 Dynamic Programming

This document provides an introduction to dynamic programming including its definition, characteristics, patterns including memoization and tabulation, and examples of each. Dynamic programming solves problems by breaking them into subproblems and storing the results to build up the overall solution.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Dynamic Programming

Here is a quick introduction to the Dynamic Programming paradigm!

We'll cover the following

• What is (https://www.educative.io/courses/algorithms-coding-
Dynamic interviews-cpp/Y5YpG2MVE7n#what-is-dynamic-
Programming? programming)
• Characteristics(https://www.educative.io/courses/algorithms-coding-
interviews-cpp/Y5YpG2MVE7n#characteristics)

• Dynamic (https://www.educative.io/courses/algorithms-coding-
Programming interviews-cpp/Y5YpG2MVE7n#dynamic-programming-
Patterns patterns)
• Memoization (https://www.educative.io/courses/algorithms-coding-
(Top Down) interviews-cpp/Y5YpG2MVE7n#memoization-top-down)

• Tabulation (https://www.educative.io/courses/algorithms-coding-
(Bottom Up) interviews-cpp/Y5YpG2MVE7n#tabulation-bottom-up)

What is Dynamic Programming? #


(https://www.educative.io/courses/algorithms-
coding-interviews-cpp/Y5YpG2MVE7n#what-is-
dynamic-programming)
Dynamic Programming algorithms solve problems by combining results of
subproblems— just like Divide and Conquer algorithms.

“Those who cannot remember the past are condemned to repeat it” –
Dynamic Programming

 
Characteristics #
(https://www.educative.io/courses/algorithms-coding-
interviews-cpp/Y5YpG2MVE7n#characteristics)
1. Overlapping Subproblems: the subproblems of a given problem are not
independent; in other words, two subproblems don’t share a
subsubproblem.

2. Optimal Substructure Property: the overall optimal solution of the


problem can be constructed from the optimal solutions of its subproblems.

Dynamic Programming Patterns #


(https://www.educative.io/courses/algorithms-
coding-interviews-cpp/Y5YpG2MVE7n#dynamic-
programming-patterns)
Memoization (Top Down) #
(https://www.educative.io/courses/algorithms-coding-
interviews-cpp/Y5YpG2MVE7n#memoization-top-down)
The memoized version of a problem is similar to the regular recursive version,
except that it looks for the answer of a subproblem in a lookup table before
computing its solution.

The top down memoization approach starts from a large problem and breaks it
down to smaller parts

Tabulation (Bottom Up) #


(https://www.educative.io/courses/algorithms-coding-
interviews-cpp/Y5YpG2MVE7n#tabulation-bottom-up)
Tabulation is the opposite of the top-down approach and avoids recursion. In
this approach, we solve the problem “bottom-up”. This is typically done by
filling up a lookup table, and computing the solution to the top/original problem
based on the results in the table.

The bottum up tabulation approach starts from a small problem and builds it up to
a larger one

You might also like