|
|
|
|
|
by chillee
2656 days ago
|
|
I'd say that in competitive programming, bottom-up is actually preferred. Bottom up is faster, usually shorter to code, and allows certain kinds of optimizations you can't do with top down (sliding window, convex hull trick, etc). Top down frees you from needing to think about order of computation, and also allows a different set of optimizations from bottom up (divide & conquer). |
|
And just for fun, while we're listing these things:
Another advantage to bottom-up that I've seen is that sometimes top-down causes your recursion to get so deep that you run out of space in your call stack. Another advantage to top-down is that you're only filling in the subset of the table that's needed for the specific problem you're solving. Certainly someone with a lot of experience should be able to do both.