From the course: Advanced Go Programming: Data Structures, Code Architecture, and Testing

Unlock the full course today

Join today to access over 24,900 courses taught by industry experts.

Common DP techniques

Common DP techniques

- [Instructor] Now that you understand the importance, benefits, and typical use cases of dynamic programming, or DP, we can learn some of its common techniques. The first programming technique that's used together with DP is recursion. A recursive function invokes itself during execution. Often recursive functions invoke themselves with different parameters which represent subproblems they're trying to solve. Function invocations are added to the call stack in the order in which they are called. The call runtime will respect this order during execution. A very important aspect of recursion is the end condition. Every recursive function must have an execution path or condition where the function stops invoking itself. If this condition is not included or never reached, the recursive function will continue calling itself until it exhausts CPU resources. A common problem used to illustrate and introduce the concept of…

Contents