What is memoization?
Yeah, that's right, memo, not memor. I asked my self this when I first saw it. Simply put, memoization can be described as the caching of the results of a sub-step within an algorithm.
That makes it perfect for recursive functions, as they waste plenty of time recomputing everything, so that's what I tried it on, a recursive function.
And what recursive function is better known than a function to calculate the Fibonacci sequence?
I then laughed at the speed differences.
I calculated 1000 iterations of the Fibonacci sequence in 1 second. Without it, it took forever. You can try any number less than 200,000 without choosing to loop, and you'll receive an answer within 10 seconds, guaranteed or I'll refund you.
Try it out yourself!
@JadenGarcia Hm, it’s not really finished yet(I’m not sure how I’ll add in the function, still working on that.... ) 51-53 and all the others like them are redundancies in case of someone else trying to use the class who’s not as well acquainted with how it works like if they accidentally pass the wrong cache to the memoizer func. Are you the same person who I worked with?