In: Computer Science
What is the auxiliary space and space complexity for a dynamic programming algorithm with time complexity of O(n^2)? Justify.
Auxiliary Space complexity of dynamic pragraming :-
int count = 0;
for (int i = N; i > 0; i /= 2)
for (int j = 0; j < i; j++)
count++;
Because auxilary space require extra space .
Space Complexity of dynamic programing :-
for(i = 0; i < n; i++)
{
for (j=i+1; j<=n;j++)
{
sum = arr[j] + arr[i];
}
}