AP Computer Science A ยท Unit 10
Recursion: every key term you need
12 flashcard terms for AP Computer Science A Unit 10, written to match the course framework. Study them here, then drill them as interactive flashcards โ free, no account needed.
Study this unit free โ
Recursion Function calls itself. Breaks problem into smaller subproblems. Must have base case (stop) and recursive case.
Base Case Condition stopping recursion. Without it, infinite recursion โ StackOverflowError. Example: if (n==0) return 1;
Recursive Case Function calls itself with smaller input. Moves toward base case. Example: return n * factorial(n-1);
Call Stack Tracks function calls. Each recursive call adds frame to stack. When base case reached, stack unwinds.
Factorial n! = n * (n-1)!. Base: 0! = 1. Example: 5! = 5*4*3*2*1. Elegant recursive solution.
Fibonacci fib(n) = fib(n-1) + fib(n-2). Base: fib(1)=1, fib(0)=0. Exponential time; use memoization to optimize.
Memoization Cache results to avoid recomputation. fib(5) calculates fib(3) multiple times; store result, reuse.
Binary Search (Recursive) Divide search space in half. Base: not found or found. Recursive: search left or right half. O(log n).
Tree Traversal Visit each node exactly once. Preorder: root, left, right. Inorder: left, root, right. Postorder: left, right, root.
String Recursion Process strings character-by-character. Example: reverse string recursively or check palindrome.
Backtracking Explore all possibilities; abandon path if constraint violated. Example: Sudoku solver, maze solver.
Unit 10 Summary Recursion: function calls itself; needs base case and recursive case. Useful for divide-and-conquer, tree traversal, backtracking.
Turn these into flashcards & quizzes โ
More AP Computer Science A guides
Crammy is a free all-in-one study hub for AP, A-Level, GCSE, IB and test prep โ flashcards, quizzes, practice exams, an AI tutor, and adaptive study sessions. Start studying free .
SAT® and AP® are registered trademarks of the College Board. ACT® is a registered trademark of ACT, Inc. None is affiliated with, sponsors, or endorses Crammy, and none has reviewed our practice material. All questions and explanations here are original. Legal & attributions .