AP Computer Science A Resource
Algorithms practice guide
A connected AP Computer Science A algorithm map for searching, sorting, recursion, array/list processing, and String manipulation.
Study Snapshot
AP unit
Units 2 and 4
Exam use
Search, sort, recursion, array/list processing, and runtime reasoning
Study time
60-75 min
Resource Navigator
Move through AP Computer Science A by skill
Best used when
Students preparing for mixed-topic MCQs and FRQs where algorithm patterns are combined.
Searching
Search questions test loop control, return values, and assumptions about the data.
Linear search checks each item until a match is found.
Binary search repeatedly halves a sorted search space.
Return -1 or false only after the search has fully failed.
Trace low, high, and mid carefully for binary search.
for (int i = 0; i < values.length; i++) {
if (values[i] == target) {
return i;
}
}
return -1;Sorting
AP Computer Science A expects students to recognize selection sort, insertion sort, and merge sort behavior.
Selection sort repeatedly chooses the next smallest value.
Insertion sort inserts each item into the sorted left side.
Merge sort divides, sorts, and merges.
Compare algorithms by trace behavior, not only by names.
Recursion and Processing
Recursive algorithms need a base case, a smaller call, and a meaningful return path.
Every recursive method needs a reachable base case.
The recursive call should move toward that base case.
Array and String algorithms often combine traversal with accumulation.
Runtime reasoning helps students compare simple loops, nested loops, and divide-and-conquer methods.
public static int sum(int n) {
if (n == 0) {
return 0;
}
return n + sum(n - 1);
}Practice checklist
Use these prompts as a short self-check before moving back into FRQs or class assignments.
For practice use only.
AP Computer Science A Algorithms Hard MCQ Practice
Practice hard AP Computer Science A searching, sorting, loop-boundary tracing, comparison counts, algorithm correctness, runtime intuition, and array/list mutation.
Answered 0 of 25
Choose one answer.
What value is returned by search(data, 4)?
public static int search(int[] data, int target) {
for (int i = 0; i < data.length; i++) {
if (data[i] == target) {
return i;
}
}
return -1;
}
int[] data = {4, 2, 4, 1};Need help applying this?
