7 ms·
It’s worth learning as an important CS concept, as it can be intuitive to express an idea and understand the algorithm on a conceptual level. Although implement
by code_devil 4y ago
It’s worth learning as an important CS concept, as it can be intuitive to express an idea and understand the algorithm on a conceptual level. Although implementing recursion can sometimes feel very confusing, apart from the fact that you might also hit a stack overflow and it runs slower than an iterative solution.
In fact, a few days ago I implemented a flood fill algorithm for a drawing app I am developing. I later converted it to an iterative solution. Here’s a comparison between the two solutions
https://zkpunk-xyz.vercel.app/posts/recursion_vs_iterative/ https://zkpunk-xyz.vercel.app/posts/recursion_vs_iterative/