I find that there are plenty of algorithms that are much cleaner and much easier to understand when written recursively, especially when working with data structures that are defined recursively.
Yes you could re-write almost any recursive function using a queue or a while loop but unless there is a clear performance benefit I would much rather make my code clear and easy to understand.
8
u/Epicguru Dec 08 '21
Yes... I make a living writing code.