chap 7 key terms and concepts Flashcards
what is a size declarator?
The number of elements, or values, the array can hold.
What happens in this line int[] numbers = new int[6];
The array is initialized with a size of 6, meaning it can hold 6 integer values.
What is a subscript?
A subscript is used as an index to pinpoint a specific element within an array. (Also known as an index).
What is the format for an enhanced for loop
for (dataType elementVariable : array)
statement;
What does the sequential search algorithm do?
The sequential search algorithm uses a loop to sequentially step through an array, starting with the first element. It compares each element with the value being searched for and stops when the value is found or the end of the array is encountered
For a 2-D Array, what is the order of Rows and columns, say in this:
double[][] scores = new double[3][4];
The first is row, then column.
What is a ragged array?
When the rows of a two-dimensional array are of different lengths.
How does the selection sort work?
The smallest value in the array is located and moved to element 0. Then the next smallest value is located and moved to element 1. This process continues until all of the elements have been placed in their proper order
How does the binary search algorithm work?
Binary search works by repeatedly dividing the search interval in half and comparing the target value with the middle element until the target is found or the search interval becomes empty, achieving a time complexity of O(log n) in a sorted array.
What are variable-length argument lists?
variable-length argument lists makes it possible to write a method that takes a variable number of arguments. In other words, you can write a method that accepts any number of arguments when it is called. When the method runs, it can determine the number of arguments that were passed to it and act accordingly.