Why does memoization rtes or tles sometimes when tabular doesnt?

Правка en1, от Dontugiveup, 2022-01-30 20:17:13

I understand that memoization creates stacks and it slows down the speed, but how? and when I shouldn't use memoization? How should I asses that memoization will fail or pass for sure. In a problem, I used memoization, it got me a tle, but then i did the same code, just except i didnt pass the vector reference, instead of this I declared the vector globally and it passed, I dont know why it happened. Since I'm kind of noob in dp now, I've been thinking to execute in both ways: memo and tabular. I reckon that memoization does the same or less number or operations than tabular.

It would be really helpful if you explain me some rte or tle stuff in memoization and why it slows down when stacks increase?

thanks in advance :)

Теги dp, dynamic programming, memoization, tabulation

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский Dontugiveup 2022-01-30 21:45:04 114
en1 Английский Dontugiveup 2022-01-30 20:17:13 806 Initial revision (published)