Back
Close

BrainFuck part 11 - Iterative and recursive ways

DPAmar
1,433 views

Conclusion

The iterative way is quite easy to implement using BF.

The recursive way can be used as well, even the tail-recursive one.

However, the tail-recursive way is probably better than the non-tail one. Indeed, without function calls in our language, the recursion is based on while...loop structures

  • the tail-recursive way looks like a loop. Actually, many compilers optimize tail-recursive codes into loops
  • the non-tail-recursive way is also possible but forces the code to get executed over a virtually large portion of our memory

Again, tail-recursive is not iterative way: solution is built using solutions for smaller problems, and not from a small problem getting bigger and bigger.

Create your playground on Tech.io
This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.
Go to tech.io
codingame x discord
Join the CodinGame community on Discord to chat about puzzle contributions, challenges, streams, blog articles - all that good stuff!
JOIN US ON DISCORD
Online Participants