Decision Problem

In AP Computer Science Principles, a decision problem is a computational problem whose answer is simply yes or no, such as "is this number prime?" or "is there a path from A to B?" It contrasts with an optimization problem, which asks for the best solution among many (EK AAP-4.A.2).

Verified for the 2027 AP Computer Science Principles examLast updated June 2026

What is Decision Problem?

A decision problem is a problem with a yes/no answer. That's the whole definition, and the AP exam takes it literally. "Is 97 prime?" Yes. "Is there a path from computer A to computer B in this network?" Yes or no. "Does this list contain the number 42?" Yes or no. If the answer to the problem can only be one of two outcomes, it's a decision problem.

The CED (EK AAP-4.A.1 and AAP-4.A.2) sets this up with two distinctions you need. First, a problem is a general task ("sorting"), while an instance is that task with specific input ("sort the list (2,3,1,7)"). Second, decision problems sit opposite optimization problems, which ask for the best answer among many options. "Is there a path from A to B?" is a decision problem. "What is the shortest path from A to B?" is an optimization problem. Same situation, different question, different problem type.

Why Decision Problem matters in AP Computer Science Principles

Decision problems live in Topic 3.17 (Algorithmic Efficiency) in Unit 3, under learning objective 3.17.A, which asks you to explain the difference between algorithms that run in reasonable time and those that don't, and to spot when a heuristic is the smarter move. The decision vs. optimization vocabulary is the entry point to that whole conversation. Classifying a problem is step one; figuring out whether an algorithm can solve it efficiently (or whether you need a heuristic or approximate solution) is step two. The College Board defines these terms precisely in the essential knowledge, so this is one of the rare spots in AP CSP where a question can hinge on whether you memorized an exact definition.

How Decision Problem connects across the course

Optimization Problem (Unit 3)

This is the partner concept the CED pairs with decision problems in EK AAP-4.A.2. The trick for telling them apart is the question word. "Is there...?" or "Does...?" means decision problem. "What is the best/shortest/cheapest...?" means optimization problem.

Heuristic (Unit 3)

When a problem can't be solved in reasonable time, LO 3.17.A says a heuristic (a good-enough shortcut) may be more appropriate. Hard optimization problems are where heuristics usually show up, and decision problems give you the vocabulary to describe what's being traded away.

Algorithm (Unit 3)

An algorithm is the step-by-step process that actually solves a problem. The decision/optimization split describes the problem, not the algorithm. The same network of computers can spawn both a decision problem and an optimization problem, each solved by different algorithms.

Approximate Solution (Unit 3)

Optimization problems can settle for an approximate solution that's close to the best. Decision problems can't, because there's no "approximately yes." That asymmetry is a clean way to remember the difference between the two problem types.

Is Decision Problem on the AP Computer Science Principles exam?

This term shows up in multiple-choice questions, and they're refreshingly direct. Typical stems ask you to pick which scenario is a decision problem rather than an optimization problem, to classify a real situation (like "can a network of computers communicate with each other?") and explain why, or to identify what is NOT a characteristic of a decision problem. Your job is classification. Read the question being asked in the scenario and check whether it has a yes/no answer or asks for a best answer. Watch for traps where the same setup is worded both ways. "Is there a route under 100 miles?" is a decision problem even though it mentions distance, because the answer is still just yes or no.

Decision Problem vs Optimization Problem

Both can describe the exact same situation, which is why they're easy to mix up. A decision problem asks a yes/no question ("is there a path from A to B?"), while an optimization problem asks for the best solution among many ("what is the shortest path from A to B?"). The quickest test is the form of the answer. If it's yes or no, it's a decision problem. If it's a specific best route, value, or arrangement, it's optimization. Note that adding a threshold turns optimization into decision: "is there a path shorter than 10 miles?" is back to yes/no.

Key things to remember about Decision Problem

  • A decision problem is a computational problem whose answer is yes or no, like determining whether a number is prime.

  • An optimization problem asks for the best solution among many, like the shortest path from A to B, while a decision problem only asks whether something is true.

  • A problem is a general task (sorting), while an instance is that problem with specific input (sorting the list (2,3,1,7)).

  • The same scenario can produce both types: "is there a path from A to B?" is a decision problem, and "what is the shortest path from A to B?" is an optimization problem.

  • On the AP exam, classify by the answer's form: yes/no means decision, best-among-many means optimization, even if the wording sounds quantitative.

  • Decision problems appear in Topic 3.17 alongside reasonable vs. unreasonable time and heuristics, all under learning objective 3.17.A.

Frequently asked questions about Decision Problem

What is a decision problem in AP Computer Science Principles?

A decision problem is a computational problem with a yes/no answer, defined in EK AAP-4.A.2 of Topic 3.17. Classic examples are "is this number prime?" and "is there a path from A to B?"

What's the difference between a decision problem and an optimization problem?

A decision problem has a yes/no answer, while an optimization problem seeks the best solution among many. "Is there a path from A to B?" is decision; "what is the shortest path from A to B?" is optimization.

Are all yes/no questions decision problems?

In the AP CSP framing, yes. If a computational problem's answer can only be yes or no, it's a decision problem by definition. Be careful in reverse, though: a question that mentions numbers can still be a decision problem if the final answer is yes/no, like "is there a route under 100 miles?"

Is a decision problem the same as a problem instance?

No. "Decision problem" describes the type of question (yes/no answer), while an instance is any problem plus a specific input. "Is a number prime?" is a decision problem; "is 97 prime?" is an instance of it (EK AAP-4.A.1).

Do I need to know decision problems for the AP CSP exam?

Yes. The term is explicitly defined in the CED under Topic 3.17 (learning objective 3.17.A), and multiple-choice questions ask you to classify scenarios as decision problems vs. optimization problems and explain why.