What this deck covers
This deck focuses on Recursive Searching And Sorting, giving you a quick way to review the definitions, rules, and examples that matter most for AP Computer Science a.
Study Recursive Searching And Sorting in AP Computer Science a with focused flashcards that help you recognize the idea, recall the key rule, and apply it in practice-style prompts.
0% Complete
What is tail recursion?
Tap card or press Space to flip
A recursion where the recursive call is the last operation. Can be optimized by compilers into iterative loops to save stack space.
How well did you know it?
Card 1 / 38
Space to flip · ← / → to move · once flipped, → Got it · ← Still learning
This deck focuses on Recursive Searching And Sorting, giving you a quick way to review the definitions, rules, and examples that matter most for AP Computer Science a.
Work through these flashcards in short sessions. Try to answer each prompt before flipping the card, then revisit any cards you miss until the explanation feels automatic.
Answer: A recursion where the recursive call is the last operation. Can be optimized by compilers into iterative loops to save stack space.
Answer: The call stack is cleared as function calls return in reverse order. Functions complete in reverse order of how they were called.
Answer: Binary search. Efficiently searches sorted arrays by recursively eliminating half the elements.
Answer: O(n log n). Divides array in half, sorts recursively, then merges sorted halves.
Answer: It prevents infinite recursion by stopping further recursive calls. Essential terminating condition that provides a direct answer without further recursion.
Answer: O(log n). Halves the search space with each recursive call.
Answer: O(n log n). When pivot consistently divides array into balanced partitions.
Answer: O(log n). Eliminates half the search space with each recursive call.
Answer: F(0)=0, F(1)=1. These are the first two Fibonacci numbers that stop the recursive sequence.
Answer: O(log n) for balanced partitions. Each recursive call adds a new frame to the call stack.
Answer: Recursion is a method where the solution to a problem depends on solutions to smaller instances. This defines the fundamental principle of breaking down complex problems into simpler versions.
Answer: A recursion where the recursive call is the last operation. Can be optimized by compilers into iterative loops to save stack space.
Answer: Binary search. Efficiently searches sorted arrays by recursively eliminating half the elements.
Answer: A stack overflow occurs when there are too many nested recursive calls. Happens when recursion depth exceeds the call stack's memory limit.
Answer: n=0, returning 1. By definition, 0!=1 and this stops the recursive multiplication.
Answer: O(n log n). When pivot consistently divides array into balanced partitions.
Answer:
Answer: O(2n). Each call branches into two more calls, creating exponential growth.
Answer: Found at index 2. Binary search finds 3 by comparing with middle elements recursively.
Answer: Memoization stores results of expensive function calls to avoid redundant calculations. Converts exponential time algorithms into linear time by caching results.
Answer: A function call where the function calls itself with modified arguments. This creates the recursive loop that reduces problem size with each iteration.
Answer: An algorithm that solves a problem by solving smaller instances recursively. Uses the divide-and-conquer principle by calling itself on smaller inputs.
Answer: O(log n). Halves the search space with each recursive call.
Answer: Holds information about active subroutines of a computer program. Tracks nested function calls and manages local variables for each recursion level.
Answer: It prevents infinite recursion by stopping further recursive calls. Essential terminating condition that provides a direct answer without further recursion.
Answer: Loops (such as for, while). Uses explicit loops instead of function calls to avoid stack overhead.
Answer: Holds information about active subroutines of a computer program. Tracks nested function calls and manages local variables for each recursion level.
Answer: Merge sort. Divides arrays recursively, then merges sorted subarrays back together.
Answer: A data structure that contains instances of itself. Examples include linked lists, trees, and graphs with self-similar structures.
Answer: O(log n) for balanced partitions. Each recursive call adds a new frame to the call stack.
Answer: O(n2). Occurs when pivot is always the smallest or largest element.
Answer: Two or more functions that call each other. Creates indirect recursion where functions depend on each other cyclically.
Answer: Simplifies code for problems that can be divided into similar sub-problems. Natural fit for problems with recursive structure like trees and mathematical sequences.
Answer:
Answer:
Answer: O(n). Stores computed values to avoid recalculating the same Fibonacci numbers.
Answer: O(n log n). Divides array in half, sorts recursively, then merges sorted halves.
Answer: A data structure that contains instances of itself. Examples include linked lists, trees, and graphs with self-similar structures.