zuai-logo
zuai-logo
  1. AP Computer Science A
FlashcardFlashcardStudy GuideStudy GuideQuestion BankQuestion BankGlossaryGlossary

Glossary

A

Accessing Consecutive Sequences

Criticality: 2

An algorithm that iterates through a collection to process elements in groups of a specified length (e.g., pairs, triplets) that are adjacent to each other.

Example:

When analyzing stock prices, you might use accessing consecutive sequences to look for patterns over three consecutive trading days.

ArrayList

Criticality: 3

A resizable array implementation in Java that belongs to the Java Collections Framework, allowing dynamic addition and removal of elements.

Example:

Instead of a fixed-size array, you might use an ArrayList to store a user's shopping cart items, as the number of items can change.

C

Checking for Duplicate Elements

Criticality: 3

An algorithm that determines if any two or more elements within a collection have the same value.

Example:

Before adding a new username to a database, you would use checking for duplicate elements to ensure the username isn't already taken.

Converting Array to ArrayList

Criticality: 1

An algorithm that transfers all elements from a fixed-size primitive array into a dynamic `ArrayList`.

Example:

When you need to add or remove elements from a fixed dataset, you would use converting Array to ArrayList to gain the flexibility of ArrayList methods.

Converting ArrayList to Array

Criticality: 1

An algorithm that transfers all elements from an `ArrayList` into a fixed-size primitive array.

Example:

If a legacy method requires a primitive array as input, you would use converting ArrayList to Array to pass your dynamic data.

D

Determining How Many Elements Fit a Criteria

Criticality: 3

An algorithm that counts how many elements in a collection satisfy a specific condition or property.

Example:

To find out how many students passed a test, you would use determining how many elements fit a criteria to count scores above a certain threshold.

Determining If All Values Have a Certain Property

Criticality: 3

An algorithm that checks every element in a collection to see if they all satisfy a specific condition, returning true only if every element meets the criteria.

Example:

To ensure all passwords in a system are strong, you might use determining if all values have a certain property to check if each password meets minimum length and complexity requirements.

E

Enhanced For Loop

Criticality: 3

A simplified loop syntax in Java, also known as a for-each loop, used for iterating over elements in arrays and collections without needing an explicit index.

Example:

To print every student's name in a students list, an enhanced for loop (for (Student s : students)) is often cleaner than a traditional indexed loop.

F

Finding a Mean

Criticality: 2

An algorithm that computes the average of numerical elements in a collection by dividing their sum by the count of elements.

Example:

After collecting daily temperatures, you could use finding a mean to determine the average temperature for the week.

Finding a Mode

Criticality: 2

An algorithm that identifies the element(s) that appear most frequently within a collection.

Example:

In a survey of favorite colors, finding a mode would reveal which color was chosen most often by respondents.

Finding a Sum

Criticality: 3

An algorithm that calculates the total sum of all numerical elements within a collection by accumulating their values.

Example:

To calculate the total cost of items in a shopping cart, you would use finding a sum on an ArrayList of prices.

Finding the Minimum/Maximum

Criticality: 3

An algorithm used to determine the smallest or largest value within a collection of elements, typically by iterating and comparing.

Example:

In a list of test scores, you'd use finding the minimum/maximum to identify the lowest and highest scores achieved by students.

M

Modifying Array Values

Criticality: 3

An algorithm that iterates through an array or ArrayList to change the value of each element based on a specific rule.

Example:

To apply a discount, you might use this algorithm to modify array values by reducing the price of each item in a products ArrayList.

Modifying Instance Variables of Objects in an Array

Criticality: 3

An algorithm that iterates through an array or ArrayList of objects and changes the state (instance variables) of each object.

Example:

If you have an ArrayList of GameCharacter objects, you could modify instance variables of objects in an array to set all characters' health to full after a level up.

R

Reversing an Array/ArrayList

Criticality: 2

An algorithm that rearranges the elements of a collection so that their order is inverted, with the first element becoming last and vice-versa.

Example:

To display a list of recent activities from newest to oldest, you might first populate an ArrayList and then use reversing an array/ArrayList to show them in the desired order.

S

Shifting Elements Left/Right

Criticality: 2

An algorithm that rearranges elements in a collection by moving each element one position to the left or right, often wrapping the element at the end/beginning.

Example:

In a game, you might use shifting elements left/right to rotate the order of players in a queue after each turn.