Do the indexes count from 1?
No, it counts from 0 to n-1.
Does using arrays instead of lots of variables save memory space?
Yes
What type of loop is best used when finding max, min and average in an array?
for loop
What is the call statement for the Array Sorting method found within the java.util.Arrays class?
Array.sort(<data type>[] <array name>);
Array.sort(int[] arr);
What is another name for binary search
Logarithmic Search
Can you change the length/size after when it is set?
No, once the size is set it can not be resized anymore.
What happens if you try to access an index that doesn’t exist?
AOB error
The 'current max' is replaced by the value from the array when the current max is greater than or less than the value from the array?
less than
What sorting technique does the following image depict?
Bubble Sort
Which type of algorithmic search usually requires a for loop?
Sequential Search (linear)
what is the general syntax
Are Java arrays homogeneous or heterogeneous data structures?
Homogenous data structures (data is the same type)
When finding the average in an array which variable needs to be initialized?
sum
Why is sorting arrays important?
It makes the data stored in arrays more usable by improving the efficiency of processes like searching.
In a binary search, how is the middle index found?
(first index + last index) / 2
What are the 3 things we need to know for declaring an array?
1. the data type that is storing in the array
2. the name of the array
3. the length/size of the array
Briefly describe what 3D arrays can be visualized like.
A cube with rows, columns, and depth, or a series of spreadsheets laid together
When finding the average of an array in the for loop
for(int j=0;j< x ;j++);{
What is x?
length of the array
How many comparisons will it take to sort the following unsorted array?
{62,2,8,97,24,7,2,10}
In a binary search, what will happen when the key is smaller than the middle index?
last index = middle index - 1
What are the two ways to initialize the elements?
1. using a for loop
2. arrayName[index] = value;
Briefly describe two uses of arrays with methods that were covered.
1. Create, initialize and return a new array
2. Pass an existing array as a parameter and manipulate its values
How does the loop help to find the min in an array?
The loop goes through every value in the array and by using an if statement it compares the value to the 'current min'
What is wrong with the following bubbleSort method?
Since j is initialized at 1 and not 0, the function will not sort the first element of the array.
What statement keeps the program in the while loop in a binary search
first index <= last index