<< Previous exercise (5.13) | Index | Next exercise (5.15) >>

meteorgan

fact-machine first push n and continue to the stack, totally 2(n-1) times, in this process, there is no pop operations. then pop stack. so the number-pushes and max-depth are both 2(n-1).

meteorgan