Skip to content

Instantly share code, notes, and snippets.

@pkutaj
Created August 19, 2026 07:35
Show Gist options
  • Select an option

  • Save pkutaj/a9150a8553198407833fa9361bc30699 to your computer and use it in GitHub Desktop.

Select an option

Save pkutaj/a9150a8553198407833fa9361bc30699 to your computer and use it in GitHub Desktop.
Explaining iteration vs recursion through peano addition snippet
| + 1 (add_r 2 4) -
| + 1 (+ 1 (add_r 1 4)) ---
| + 1 (+ 1 (+ 1 (add_r 0 4))) ------> space complexity
| + 1 (+ 1 (+ 1 4)) ---
| + 1 (+ 1 5) -
| + 1 6
V 7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment