One Pager Cheat Sheet
Dynamic Programming (DP) with Memoization is a technique for optimizing the solution of overlapping sub-problems to anexponential time solutionto apolynomial time solution, while using additional memory to store intermediate results.- This sentence summarizes the concept of Fibonacci Numbers, which is defined and implemented utilizing a recursive design pattern, wherein each number is the sum of the two preceding numbers
in the sequence. - By examining the recursion tree for computing
fibonacci(5), we can deduce an exponentialO(2^n)complexity, with potential for speedups by using stored intermediate results. - We can reduce the exponential time complexity of our Fibonacci computation from
O(2^n)toO(n)using a simplememoizationtechnique with only two extra memory spaces. - Dynamic Programming (DP) is a powerful algorithmic technique used to efficiently solve problems with optimal solutions and overlapping sub-problems through
memoization, reducing the complexity from exponential (O(n^2)) to linear (O(n)). - Finding the path with the highest reward through an
m * ngrid usingBacktrackingrequires enumerating all possible paths and selecting the one with the maximum reward, resulting in an exponential time complexity of O(2). - By combining the technique of Dynamic Programming with the Memoization of accumulated rewards stored in the
rewardmatrix, we can find the optimum, or best, path from the start to goal that collects the maximum reward. - The pseudo-code finds the maximum reward when moving up or right on a
m x ngrid, from(0, 0)to(m-1, n-1). - The
optimal pathto a maximum reward can be found by filling an additional matrixdwhich stores thepredecessorfor each cell(r, c)when finding themaximum path. - We can use the
direction matrixtobacktrackfrom the goal cell to the start cell andpopthe elements off a stack to get the final path. - Using Dynamic Programming and Memoization, we can drastically reduce the time complexity from O(2) to
O(m * n), but with acost of additional storageofO(m * n)space complexity. - Memoization is a
techniquewhich increases space complexity but drastically reduces time complexity, allowing for a significantly faster algorithm. - The
problem parametersgiven allow us to usedynamic programmingandmemoizationto solve the weighted interval scheduling problem in order tomaximizethe total weight of thenon-overlappingintervals. - A maximum weight for an interval can be computed recursively by either including or excluding it, and looking at the intervals
j-1and lower for exclusion. - By using
Memoization, we can drastically reduce time complexity and optimize the code efficiency ofDynamic Programmingfor Scheduling. - We can
retrieve theinterval setusing thepredecessor arraypand theBoolean arrayX`. - The time complexity of the Memoized version of Weighted Interval Scheduling is
O(n), assuming the intervals are already sorted according to their finish times. - The Longest Increasing Subsequence (LIS) problem using dynamic programming with memoization has a time complexity of O(n^2), achieved by
two nested loops of O(n)computations for each of thenslots. - The space complexity of solving the Longest Increasing Subsequence (LIS) problem using dynamic programming with memoization is O(n).

