In AP Computer Science Principles, an algorithm is a finite, step-by-step procedure for solving a problem or completing a task, expressed in pseudocode, code, or flowcharts, and evaluated by how efficiently it runs and whether it produces fair, unbiased results.
An algorithm is a step-by-step set of instructions that solves a problem or accomplishes a task in a finite number of steps. Think of it as a recipe. The recipe isn't the cake, and an algorithm isn't a program. It's the underlying plan that a program implements. You can write the same algorithm in pseudocode, in a flowchart, or in any programming language, and it's still the same algorithm.
AP CSP cares about algorithms on three levels. First, can you read and trace one (like binary search, which repeatedly cuts a sorted list in half per EK AAP-2.P.1)? Second, can you judge one's efficiency, separating algorithms that run in reasonable time from those that don't (EK AAP-4.A.3), and recognizing when a heuristic shortcut makes more sense? Third, can you spot when an algorithm causes harm? EK IOC-1.D.1 says computing innovations can reflect human biases because of biases written into the algorithms themselves or baked into their training data.
Algorithms are the spine of Unit 3 (Algorithms and Programming) and a major thread in Unit 5 (Impact of Computing). Learning objective 3.11.A asks you to determine how many iterations binary search needs and explain its requirements (the data must be sorted). LO 3.17.A asks you to tell reasonable-time algorithms apart from unreasonable ones and identify when a heuristic is the better call. Then Unit 5 flips the lens. LO 5.3.A asks you to explain how bias gets embedded in algorithms and what programmers should do about it (EK IOC-1.D.2). So the same word, algorithm, carries you from tracing pseudocode to debating fairness in facial recognition. Few terms span more of the CED.
Keep studying AP Computer Science Principles Unit 5
Algorithmic Efficiency (Unit 3)
Two algorithms can solve the same problem while one finishes in seconds and the other takes longer than the age of the universe. Topic 3.17 is where you learn to sort algorithms into 'reasonable time' and 'not reasonable time' buckets.
Binary Search vs. Linear Search (Unit 3)
These two are the CED's go-to example that algorithm choice matters. Linear search checks every item one by one; binary search halves a sorted list each step, so it's usually far more efficient. The catch from EK AAP-2.P.2 is that binary search only works on sorted data.
Heuristic (Unit 3)
When an exact algorithm can't run in reasonable time, a heuristic trades a guaranteed-best answer for a good-enough answer you can actually compute. LO 3.17.A.b asks you to identify exactly these situations.
Computing Bias (Unit 5)
Algorithms aren't neutral. EK IOC-1.D.1 says bias can be written into the algorithm itself or live in the data it learns from, and EK IOC-1.D.3 warns it can sneak in at every level of software development. This is the bridge between writing code and judging its impact.
Multiple-choice questions hit algorithms from two angles. Unit 3 style questions give you a scenario or pseudocode and ask you to trace it, count binary search iterations, or pick the more efficient approach. Unit 5 style questions describe a real-world algorithm gone wrong, like a resume screener favoring certain universities, a loan algorithm rejecting certain zip codes, or a healthcare algorithm discriminating against certain populations, and ask you to identify the cause of the bias or the best fix (usually auditing the algorithm and its training data, per EK IOC-1.D.2). Algorithms also anchor the Create Performance Task. Your written responses must explain how your program's algorithm works, including sequencing, selection, and iteration, and released scoring criteria (like 2023 Q1, Q5, and Q6 and the 2024 written responses) score you on how clearly you can describe and justify your algorithm's behavior.
An algorithm is a precise procedure that, if correct, always produces the right answer. A heuristic is a shortcut that produces an approximate or 'good enough' answer when the exact algorithm would take unreasonable time. On the exam, if a question says the optimal solution can't be computed in reasonable time, the answer almost always involves using a heuristic instead. Don't say a heuristic is a 'broken algorithm.' It's a deliberate trade of perfection for speed.
An algorithm is a finite, step-by-step procedure for solving a problem, and it can be expressed in pseudocode, flowcharts, or any programming language.
Binary search starts at the middle of a sorted data set and eliminates half the data each iteration, which makes it usually more efficient than linear search but only on sorted data.
Efficiency estimates the computational resources an algorithm uses, and AP CSP draws a hard line between algorithms that run in reasonable time and those that don't.
When no algorithm can find the exact best answer in reasonable time, a heuristic that finds an approximate answer is often the appropriate choice.
Algorithms can carry human bias, either written into the steps themselves or absorbed from biased data, and programmers are responsible for taking action to reduce that bias.
On the Create Performance Task, you have to explain how your own algorithm works, so practice describing sequencing, selection, and iteration in plain written English.
An algorithm is a finite, step-by-step procedure for solving a problem or completing a task. In AP CSP you'll trace algorithms like binary search, compare their efficiency, and analyze how they can embed bias (Topics 3.11, 3.17, and 5.3).
No. The algorithm is the plan; the program is one implementation of that plan in a specific language. The same binary search algorithm can be written in Python, JavaScript, or AP pseudocode and it's still one algorithm.
An algorithm guarantees a correct answer if followed exactly, while a heuristic sacrifices that guarantee to get a good-enough answer fast. Per LO 3.17.A, heuristics are appropriate when the exact algorithm can't run in reasonable time.
No. The CED's exclusion statement says specific implementations of binary search are outside the scope of the exam. You do need to know it requires sorted data, halves the data each iteration, and is usually more efficient than linear search.
Yes. Per EK IOC-1.D.1, bias can be written directly into an algorithm's rules or learned from biased data, like a resume screener that favors certain universities. Exam questions ask you to identify the source of the bias and how programmers should reduce it.