Arrays Flashcards
1
Q
initialize arrays
A
type [] name = new int [size]
or
type [] name = {data 1, data 2, data 3, …}
2
Q
Set value in arrays
A
name[index] = value
3
Q
set all values in arrays
A
for (int i = 0; i< name.length; i++) {
name[i] = values;
}
4
Q
sequential search in arrays
A
going through one by one
5
Q
binary search
A
splitting it in half and searching through it that way
6
Q
selection sort
A
searches and swaps
7
Q
insertion sort
A
compares two at a time and swaps them depending on the rule
8
Q
merge sort
A
uses recursion
split into two
each piece is sorted
merges them
continues the process till the whole thing is sorted