Practice

Worked example: a review

Scene

A discipline-flavored review of a naive recursive Fibonacci.

Code under review
def fibonacci(n):\n    if n <= 1:\n        return n\n    return fibonacci(n-1) + fibonacci(n-2)
The actual defect

Exponential recursion. Past n≈30 it falls over.

A memoized version is O(n). Say that, show the code, and give the complexity. The insult is optional flavor. The complexity is the review.

A v4 review still ends at the gate: claims, evidence, puax_verify_completion. Tone does not replace the benchmark.

Previous
Next