WRITELOOP

GROKKING ALGORITHMS - STACKS TRADEOFFS

2022 April 25

Using stacks is convenient, but there is a memory cost - since the taller the stack is, higher the memory requirements.

The alternatives to overcome that are 2:

  • Rewrite the code to use a loop
  • Use “tail recursion”, which is supported by some languages.
NOTE: The original content(s) that inspired this one can be found at:
https://www.amazon.com/Grokking-Algorithms-illustrated-programmers-curious/dp/1617292230
All copyright and intellectual property of each one belongs to its' original author.