I'm a college student I came to this site by chance About computer theory, including programming languages, from one to ten You seem to know a lot.
Are you a senior developer in your current job? I respect you
Let me ask you a question. I would appreciate it if you could briefly explain about Dynamic programming
algorithm
Not Demi, but...
Dynamic programming refers to a methodology that solves problems in an optimal way Usually, when you use a recursive function, you repeat the previously used action Save the results of this task and recycle the data you saved during the repetitive task Used to reduce the number of operations.
For example, when the Fibonacci function is as follows,
int f(int n)
{
if(n == 0 || n == 1)
return n;
else
return f(n-1) + f(n-2);
}
In order to obtain f(4), the following operation is performed
f(4) = f(3) + f(2)
f(3) = f(2) + f(1)
where f(2) is called twice. An example of dynamic planning is to store the results of f(2) in advance and use the results saved when f(2) is called.
© 2024 OneMinuteCode. All rights reserved.