Each function uses a certain space during the run, and is used to save various states in the function run, such as return addresses, function parameters, and local variables. For recursive functions, since each call needs to be assigned different runspaces, once a layer is enabled, it will open new space. And when a layer is executed, it releases the corresponding space and retreats to the previous layer. It can be seen that when the space required for the recursive process is constant C, the cost of the entire dynamic space is related to the depth of recursive. If the recursive depth is h, the cost of dynamic space is c
*
hide