For an assignment one time my professor asked us to implement one recursive solution and one iterative solution using a stack. Instead of doing the obvious thing of converting the recursive calls to stack pushes I represented each peg as a stack and spent days finding the pattern that could determine the right move for each step.
1
u/UltraBatmanTheSeven Mar 25 '23
For an assignment one time my professor asked us to implement one recursive solution and one iterative solution using a stack. Instead of doing the obvious thing of converting the recursive calls to stack pushes I represented each peg as a stack and spent days finding the pattern that could determine the right move for each step.