Why does memoization rtes or tles sometimes when tabular doesnt?

Revision en2, by Dontugiveup, 2022-01-30 21:45:04

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 :)

Update: would feel better if i got some helping answers along with downvotes if it makes no sense to you guys.

Tags dp, dynamic programming, memoization, tabulation

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English Dontugiveup 2022-01-30 21:45:04 114
en1 English Dontugiveup 2022-01-30 20:17:13 806 Initial revision (published)