Glossary
Accessing Consecutive Sequences (2D Array)
An algorithm that extracts and processes contiguous sub-sequences of a specified length from a 2D array, typically by first converting it to a 1D array.
Example:
In a grid of numbers, to find all possible sets of three adjacent numbers (horizontally or vertically), you might use Accessing Consecutive Sequences (2D Array).
Calculating Mean of 2D Array
An algorithm that computes the average value of all numerical elements in a two-dimensional array by dividing their sum by the total count of elements.
Example:
To find the average score of all students across multiple subjects stored in a 2D array, you would use the Calculating Mean of 2D Array algorithm.
Checking All Elements for Property (2D Array)
An algorithm that verifies if every single element in a two-dimensional array satisfies a specific condition or property.
Example:
To confirm if every item in a warehouse inventory (represented by a 2D array) has a positive stock count, you would use Checking All Elements for Property (2D Array).
Checking for Duplicates in 2D Array
An algorithm that determines if any element appears more than once within a two-dimensional array.
Example:
Before assigning unique IDs to items in a grid, you might run Checking for Duplicates in 2D Array to ensure no ID has been accidentally reused.
Counting Elements by Criteria (2D Array)
An algorithm that counts the number of elements in a two-dimensional array that satisfy a specific condition.
Example:
To determine how many students scored above 90% in a class represented by a 2D array of grades, you would use Counting Elements by Criteria (2D Array).
Finding Minimum/Maximum in 2D Array
Algorithms used to determine the smallest or largest element within a two-dimensional array by iterating through all its elements.
Example:
To discover the highest temperature recorded across multiple weather stations over several days, you would use an algorithm for Finding Minimum/Maximum in 2D Array.
Finding Mode in 2D Array
An algorithm that identifies the element(s) that appear most frequently within a two-dimensional array.
Example:
If you have a 2D array representing survey responses, Finding Mode in 2D Array could tell you the most common answer given.
Modifying 2D Array Values
The process of changing the data stored at specific row and column indices within a two-dimensional array.
Example:
If a game requires updating a specific cell on a board, you would use Modifying 2D Array Values by assigning a new value to board[row][col].
Modulo Operator
An arithmetic operator (`%`) that returns the remainder of a division operation.
Example:
To check if a number n is even, you can use the Modulo Operator: n % 2 == 0.
Populating 1D Array from 2D Array
The algorithm for transferring all elements from a two-dimensional array into a single one-dimensional array.
Example:
If you need to apply a sorting algorithm designed for 1D arrays to data initially stored in a grid, you would first use the Populating 1D Array from 2D Array algorithm.
Populating ArrayList from 2D Array
The algorithm for transferring all elements from a two-dimensional array into a single one-dimensional `ArrayList`.
Example:
To collect all numbers from a grid of lottery tickets into a single list for processing, you would use the Populating ArrayList from 2D Array algorithm.
Sequential Search (2D Array)
An algorithm that iterates through each element of a 2D array, row by row or column by column, to find a specific target element.
Example:
To locate a specific student's score in a grid of test results, you would perform a Sequential Search (2D Array), checking each score until a match is found.
Summing 2D Array Elements
An algorithm that calculates the total sum of all numerical elements present within a two-dimensional array.
Example:
To calculate the total sales across all regions and product categories from a sales matrix, you would use the Summing 2D Array Elements algorithm.
autoboxing
The automatic conversion that the Java compiler performs between primitive types (like `int`) and their corresponding object wrapper classes (like `Integer`).
Example:
When you add a primitive int to an ArrayList<Integer>, Java automatically converts the int to an Integer object through autoboxing.
column-major traversal
A method of iterating through a 2D array where all elements in the current column are processed sequentially before moving to the next column.
Example:
If you're analyzing data vertically in a matrix, processing all entries in the first column, then the second, and so on, you're using column-major traversal.
enhanced for loop
A simplified loop syntax in Java designed for iterating over elements in arrays or collections without needing to manage an index.
Example:
To easily display each fruit in a String[] fruits array, you could use an enhanced for loop: for (String fruit : fruits).
for loop
A control flow statement that allows code to be executed repeatedly based on an initialization, a boolean condition, and an update expression.
Example:
To print numbers from 0 to 9, you would use a for loop like for (int i = 0; i < 10; i++).
nested for loops
A programming construct where one `for` loop is placed inside another, commonly used to iterate through elements in multi-dimensional data structures like 2D arrays.
Example:
To process every cell in a game board represented by a 2D array, you would typically use nested for loops, with an outer loop for rows and an inner loop for columns.
pass-by-value
In Java, when primitive data types or object references are passed as arguments to a method, a copy of the value (or reference) is made, meaning changes to the copy do not affect the original variable outside the method.
Example:
If you pass an int variable x to a method that tries to change x, the original x remains unchanged because Java uses pass-by-value for primitives.
row-major traversal
A method of iterating through a 2D array where all elements in the current row are processed sequentially before moving to the next row.
Example:
When printing a spreadsheet's contents from top-left to bottom-right, completing each row before starting the next, you are performing a row-major traversal.