Number of unique paths for robot pathfinding #20
kevinlin1
started this conversation in
Show and tell
Replies: 1 comment 2 replies
-
Thanks for sharing, Kevin! Given the lack of recursive calls for that second one (it's quite a contrast to the first), do you step through that with PythonTutor? I like to also visualize robot-grid stuff using a turtle graphics animation, though I can't find the ones I made for UC berkeley, and that might not be as appropriate for this function. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Thanks for offering this service, Pamela!
The recursion visualizer is great for tree recursion (aka multiple recursion). I'm introducing dynamic programming by using a motivating example of robot pathfinding in a 2-D grid, and I like to compare the dynamic programming approach to a tree recursive program that students have seen before. The recursion visualizer is a nice way to refresh the idea and showcase the calls to the same subproblems.
A call to
paths(2, 2)
shows the way that the algorithm finds 6 total paths to get from position (0, 0) to position (2, 2) in a 3x3 grid. I can then compare this to the dynamic program:Beta Was this translation helpful? Give feedback.
All reactions