Версия для печати темы
Нажмите сюда для просмотра этой темы в оригинальном формате
Форум программистов > Функциональные языки: общие вопросы > What are the signs that indicate memoization


Автор: Aviral20 21.2.2023, 16:16
I'm trying to understand when to use memoization in Python, even though I'm able to implement it when necessary.


How would you identify overlapping subcalls in a recursive function during a coding interview? Would you draw out all the calls (even if some of them go 5-6 levels deep in an O(2^n) complexity brute force solution)?

Cases like the Fibonacci sequence make sense because the overlap happens immediately (the 'fib(i-1)' call will almost immediately overlap with the 'fib(i-2)' call). But for other cases, like the knapsack problem, I still can't wrap my head around how anyone can identify that memoization should be used while at an interview. Is there a quick way to check for an overlap?
I took online reference from here: https://www.interviewbit.com/manual-testing-interview-questions/

I hope my question makes sense. If someone could point me to a good resource, or give me clues to look for, I would really appreciate it. Thanks in advance.

Автор: hotpotothers 29.3.2023, 05:13
Требуется мужество, чтобы сесть и сделать эту работу. Похлопайте себя по плечу и помните, что вы удивительный человек.
https://spacebarclicker.co/

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)