I came to knew that space required by an recursive algorithm for each call is allocated on a call stack. So if the complete execution of an algorithm takes 'n' no. of blocks on call stack then total space required will be 'n*k' where 'k' is the size of each block , since k is machine dependent , it is ignored in asymptotic analysis so space required will be O(n) . My conclusion is that if only no. Of blocks on call stack are considered then including input size or not in each block on call stack will not matter. So auxilliary space and space complexity must be same. Isn't it??
Asked
Active
Viewed 35 times
0
-
What do yo mean by "including input size or not in each block on call stack" ??? – Sep 11 '18 at 09:04
-
You can only ignore the size of each block if the size is constant (or at least bounded above by a constant). This is *often* true, but it's not *always* true. `n` is typically the size of the input, which is not necessarily the number of blocks on the call stack, so that may be a bit confusing. – Bernhard Barker Sep 11 '18 at 12:30