Update README.md

This commit is contained in:
marina 2023-08-07 16:58:11 -07:00 committed by GitHub
parent 4ed4ef89c6
commit d407a66536
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -126,8 +126,8 @@ def climb_stairs_memoization(n: int) -> int:
<br> <br>
* there are mainly two parts of the space consumption that one should see in a recursive algorithm: * there are mainly two parts of the space consumption that one should see in a recursive algorithm:
* recursion related space: refers to the memory cost that is incurred directly by the recursion, i.e. the stack to keep track of recursive function calls. in order to complete a recursive call, the system allocates some space in the stack to hold: the returning address of the function call, the parameters that are passed to the function call, the local variables within the function call. once the function call is done, the space is freed. for recursive algorithms, the function calls chain up successively until it reaches a base case, so the space used for each call is accumulated. overconsumption can cause stack overflow. * **recursion related space**: refers to the memory cost that is incurred directly by the recursion, i.e. the stack to keep track of recursive function calls. in order to complete a recursive call, the system allocates some space in the stack to hold: the returning address of the function call, the parameters that are passed to the function call, the local variables within the function call. once the function call is done, the space is freed. for recursive algorithms, the function calls chain up successively until it reaches a base case, so the space used for each call is accumulated. overconsumption can cause stack overflow.
* non-recursive related space: refers to the memory that is not directly related to recursion, which includes the space (normally in heap) that is allocated for global variables. * **non-recursive related space**: refers to the memory that is not directly related to recursion, which includes the space (normally in heap) that is allocated for global variables.
<br> <br>