CSE 2050 Exam 2 - Recursion, Sorting, and Hashing with Correct Verified Answers| Latest 2024
emoization - ANSWER Write the recursive function top-down. Alter the function to check if we've already calculated the value. If so, use the pre-calculated value, If not, do the recursive call. Fib - Memo - ANSWER def fib(n, fib_cache): if n in fib_cache: return fib_cache[n] fib_cache[n] = fib(n-1, fib_cache) + fib(n-2, fib_cache)
Escuela, estudio y materia
- Institución
- CSE 2050
- Grado
- CSE 2050
Información del documento
- Subido en
- 1 de julio de 2024
- Número de páginas
- 14
- Escrito en
- 2023/2024
- Tipo
- Examen
- Contiene
- Preguntas y respuestas
Temas
-
cse 2050 exam 2
-
recursion sorting and hashing
Vista previa del contenido
Documento también disponible en un lote