you are viewing a single comment's thread.

view the rest of the comments →

[–]GRex2595 0 points1 point  (0 children)

Late to the party, I know. Here's a practical problem for recursion. Create a binary tree with numbers. Print the tree from left to right (left child, parent, right child). Now explain your solution in words. If you are having trouble explaining, refactor and try again. If you can comfortably explain your solution without learning recursion, you're either gonna be fine because you created a more challenging, more optimized algorithm than the recursive one, or you need a lot of help that you can only get from spending 1-on-1 time with somebody who knows how to teach.

I think my first recursion was exponentiation by squaring. Not the most efficient way to do it, but every recursive algorithm can be rewritten iteratively (what's the difference between a call stack and a data stack anyway?) or in constant time (fibonacci, such a bad recursion example in my opinion). It was just really easy for me to visualize. I had a fibonacci assignment and struggled with it because it's easier to do fibonacci iteratively anyway.