return mx;[/code] Which method is used by line 4 of the above code snippet?

return mx;[/code]
Which method is used by line 4 of the above code snippet?
A. Divide and conquer
B. Recursion
C. Both memoization and divide and conquer
D. Memoization
 
Answer: D
Explanation: The array “sum” is used to store the previously calculated values, so that they aren’t recalculated. So, line 4 uses the memoization technique.
 

Tìm kiếm

Back
Top