Whats the difference between these two programs in terms of stack blocks allocated?
```
int factorial(int n) {
if (n == 0) return 1;
return n * factorial(n - 1);
}
```
```
int factorial(int n, int accumulator = 1) {
if (n == 0) return accumulator;
return factorial(n - 1, n * accumulator);
}
```
hint: think of Tail-Call optimisation.
@ChShersh I like to ask it to generate questions for me about the topics from the article. Then I try to find out answers I don't know from the article itself. Makes reading feel more interactive, and keeps me from reading stuff i already know about.
Finished a concurrent version of this that uses a read-write lock instead of just a mutex. Was super fun. Onto making this whole thing more cache-friendly!