Tail Recursion
Iterative Memory Use iterativeFact requires ~12 bytes of storage Regardless of n
Iterative Memory Use recursiveFact requires ~8 bytes of storage Per function call!!!
Limited Space Stack has X amount of space Deep recursion will run out of memory:
Tail Recursion Tail recursive function : One that does no work after recursive call other than return answer Calculates on way in using extra parameter
Tail Call Optimization Compiler can reuse stack frame… only allocate one chunk of memory