Difference between asymptotic running time and asymptotic space required for a dynamic program

179 Views Asked by At

I'm not exactly sure what the difference between these two are. Basically I have a problem that I describe how to complete recursively and then I have so give the asymptotic running time and asymptotic space required for it. I know these have to with giving the Big-O notation but I'm not certain and don't really understand the difference between the two.

1

There are 1 best solutions below

2
On

Asymptotic running time is a time your program need to compute result for an input of lenght $n$.

Asymptotic space required is how many space will your program use in order to compute result for an input of lenght $n

Both of them should be written in O-e.t.c. notations.

For example if for input of lenght $n$ you need to do at least $5 n$ computational steps your time will be O(n).

If you need to create 3 matrices $n\times n$ in size each in order to compute the result for an input of length $n$ you require O(n^2) space.