PrepGo

AP Computer Science Principles Flashcards: Developing Algorithms

Written by AP Content Team, Verified for 2026 AP Exams, Last updated: May 2026

Review key ideas with interactive flashcards. This set includes 21 cards to help you master important concepts.

What are the two fundamental actions programmers perform with algorithms?
Programmers create algorithms and also combine and modify existing algorithms to solve problems.
Card 1 of 21

All Flashcards (21)

What are the two fundamental actions programmers perform with algorithms?
Programmers create algorithms and also combine and modify existing algorithms to solve problems.
What is the relationship between conditional statements and Boolean expressions?
Some conditional statements can be written as equivalent Boolean expressions, and conversely, some Boolean expressions can be written as equivalent conditional statements.
What are the three main ways new algorithms can be created?
Algorithms can be created from a new idea, by combining existing algorithms, or by modifying existing algorithms.
What is an 'algorithmic building block'?
It is an existing, correct algorithm used as a component to construct a new, more complex algorithm.
In algorithm analysis, what does it mean to compare multiple algorithms?
It means to determine if they yield the same side effect or result when given the same inputs.
How can the Boolean expression `isFinished == true` be written as an equivalent conditional statement?
It could be written as: IF (isFinished == true) { // perform action }.
Why is 'reducing testing' a benefit of using existing algorithms?
It is a benefit because the existing algorithm (the building block) has already been tested, so testing efforts can focus on the new logic.
What is a key principle regarding the relationship between different algorithms and a single task?
Algorithms can be written in different ways and still accomplish the same tasks.
What is a potential pitfall when comparing algorithms that appear very similar?
Algorithms that appear similar can yield different side effects or results, requiring careful comparison and testing.
What are the three main benefits of using existing, correct algorithms as building blocks?
Using existing algorithms reduces development time, reduces testing, and simplifies the identification of errors.
A programmer needs to create a pathfinding function for a robot. Why is it beneficial to start by looking at existing pathfinding algorithms?
Using an existing correct algorithm reduces development time and simplifies error identification, as the base logic is already proven.
What must be true for two different algorithms to be considered valid solutions for the same problem?
Both algorithms must yield the same correct result or side effect for the problem they are intended to solve.
To write a program that checks if a number is a perfect square, you might first need a function to check for divisibility. This is an example of what process?
This is an example of combining or using an existing algorithm (checking for divisibility) to help construct a new one.
You need to write a program to find the highest score in a list. What type of existing algorithm would be a useful building block?
An existing algorithm for determining the maximum value in a set of data would be a useful building block for this task.
Can two algorithms that follow different steps still be considered equivalent solutions?
Yes, as long as they both yield the same correct result or side effect for the same problem, they can be considered equivalent solutions.
How can the conditional statement `IF (x > 10) { return true; } ELSE { return false; }` be written as an equivalent Boolean expression?
This can be simplified to the equivalent Boolean expression `return x > 10;`.
Why is it important to test an algorithm even after making a small modification?
It is important because algorithms that appear similar, even with slight modifications, can yield different side effects or results.
If you have an algorithm to calculate the sum of a list, how could you modify it to compute the average?
You could modify the summing algorithm by adding a step to count the number of items and then dividing the final sum by that count.
How does using existing algorithms simplify error identification?
When an error occurs, developers can be more confident that the issue is in the new logic they wrote, not in the pre-tested building blocks.
Is there only one correct algorithm to solve a particular problem?
No, different algorithms can be developed or used to solve the same problem.
How does knowledge of existing algorithms, like finding a minimum value, help in development?
Knowledge of existing algorithms can help in constructing new, more complex ones by providing proven building blocks.