CSCI 4513
Week 6, Lecture 11
Recursion is when a function calls itself to solve smaller versions of the same problem.
function factorial(n) {
// Base case
if (n === 1) return 1;
// Recursive case
return n * factorial(n - 1);
}
factorial(5); // 120
Both options are equally valid! Choose what serves your learning best right now.
Today's challenges come from The Odin Project's Computer Science section:
Important Guidelines:
npm testWork on any incomplete homework assignments. Ask questions. Use this time to catch up and solidify your understanding!
We are largely skipping this section of The Odin Project:
π‘ But Don't Ignore It Completely!
When you have time, work through these exercises on your own. They make excellent portfolio items and great practice for technical interviews. The data structures and algorithms here are fundamental CS knowledge!
π Next Class: Intermediate Git
π Competition Winners: TBDβgreat job everyone!