Glossary
Accessing Consecutive Sequences
An algorithm that processes elements in an array by grouping them into contiguous sub-sequences of a specified length.
Example:
When analyzing stock prices, you might use accessing consecutive sequences to look at every 3-day trend (e.g., day 1-3, day 2-4, day 3-5).
Checking All Elements for a Property
An algorithm that verifies if every element in an array satisfies a specific condition, returning true only if all elements meet the criteria.
Example:
To confirm if all elements have a certain property, like being positive, you'd check each number and immediately return false if any are negative.
Checking for Duplicate Elements
An algorithm that determines if any two or more elements within an array have the same value.
Example:
Before assigning unique IDs, you might use checking for duplicate elements to ensure no two users accidentally receive the same ID.
Counting Elements by Criteria
An algorithm that counts how many elements in an array satisfy a specific condition or property.
Example:
To find out how many students scored above 90 on a test, you would use counting elements by criteria to tally each score meeting that condition.
Finding a Mean
An algorithm that computes the average of all elements in an array by dividing their sum by the total number of elements.
Example:
Determining the mean grade for a test involves summing all student scores and then dividing by the number of students.
Finding a Mode
An algorithm that identifies the element(s) that appear most frequently in an array.
Example:
If you want to find the mode of favorite colors among a group, you'd count how many times each color appears and pick the most frequent.
Finding a Sum
An algorithm that calculates the total sum of all elements within an array by accumulating each value.
Example:
To calculate the sum of all sales figures for the month, you would add each daily sale amount to a running total.
Finding the Maximum
An algorithm that iterates through an array to locate and return the largest value present.
Example:
When searching for the maximum score in a class, you'd check each student's score against the highest one encountered.
Finding the Minimum
An algorithm that iterates through an array to locate and return the smallest value present.
Example:
To find the minimum temperature recorded in a week, you'd compare each day's temperature to the lowest one found so far.
Reversing an Array
An algorithm that creates a new array or modifies an existing one so that the order of its elements is inverted.
Example:
If you have a list of steps for a recipe and want to see them in reverse order, you would apply reversing an array to the list.
Shifting Elements Left
An algorithm that moves each element in an array one position to the left, typically wrapping the first element to the end.
Example:
In a game, if you have a queue of players, shifting elements left could move the player at the front to the end of the line after their turn.
Shifting Elements Right
An algorithm that moves each element in an array one position to the right, typically wrapping the last element to the beginning.
Example:
To insert a new item at the beginning of a list without losing data, you might first use shifting elements right to make space.