|
|
|
|
|
by dahart
2954 days ago
|
|
Ah, you beat me to it. I came to make the same suggestion. DP is fancy caching, but you have to think about the space of the solution to do it right. It's not just easier to cache the results and use the recursive solution, but the code is often smaller and clearer too. I spent some time understanding and coding up edit distance between trees DP-style, which is a fair bit trickier than edit distance between strings. At the end of the whole project, I wished I had simply memoized. |
|