Dynamic programming can be done bottom up as well as top down and personally I find that makes way more sense.
Who would write a recursive function to calculate Fibonacci numbers when you can just start at the lowest two Fibonacci numbers and calculate them in sequence and obviously do each one once.
Scene with merge sort Vs quicksort. Don't mess around with recursively splitting the array, just split it into arrays of length 1 and then merge them back together in a sorted way.
View all comments
2
u/parkway_parkway 1d ago
Dynamic programming can be done bottom up as well as top down and personally I find that makes way more sense.
Who would write a recursive function to calculate Fibonacci numbers when you can just start at the lowest two Fibonacci numbers and calculate them in sequence and obviously do each one once.
Scene with merge sort Vs quicksort. Don't mess around with recursively splitting the array, just split it into arrays of length 1 and then merge them back together in a sorted way.
Recursive functions are as tricksy as hobbitses.