Recursion
Learn Recursion (Algorithms, Programming Fundamentals) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.
This topic focuses on designing algorithms recursively - taking a real problem and expressing its solution as a smaller version of itself. We assume you already know that a recursive method is one that calls itself; here we practice building recursive solutions step by step. Every recursive algorithm needs two things: • A base case - the simplest input, solved directly without further recursion. • A recursive case - breaks the problem into a smaller version of itself, plus a call to the method again.