Class in Java which acts as a List
What is an ArrayList?
The ability to write a generic class/method and have it be able to handle different types of objects
What is the purpose of generics ?
The rate at which the number of operations increases as the input size grows
What is Big O?
Organizing data to make data retrieval much faster
What is the purpose of sorting?
An Object that represents an issue or a condition that prevents execution from proceeding normally
What is an Exception?
Line of code to import ArrayList
What is import java.util.ArrayList;?
The key benefit of generics is to allow errors to be caught at _______
What is compile time?
Big O of f(x) if f(x) = 2x+5
What is Big O(n)?
Big O of Insertion Sort
What is O(n^2)?
2 types of Exceptions
What are Checked and Unchecked Exceptions?
Code to create an ArrayList called nums that holds Integers and has an initial capacity of 10
What is ArrayList<Integer> nums = new ArrayList<>(10);?
The character(s) that surround a generic parameter in Java
What is angle brackets / < >?
Big O of binary search
What is O(log n)?
Sort that works by repeatedly swapping adjacent, out-of-order elements through the array, moving the smallest element to its proper location
What is Bubble Sort?
Unchecked Exceptions extend this
What is a RuntimeException?
Method to check the number of elements in an ArrayList
What is size( )?
The Java convention for a generic parameter that represents members of a List
What is E?
Name 2 runtimes that are more efficient than O(n)
What is O(1) and O(log n)?
The only type of list you can run binary search on
What is a sorted list?
FileNotFoundException is this kind of Exception
What is a Checked Exception?
Code to change the second element in an ArrayList called arr to "I <3 1331"
What is arr.set(1, "I <3 1331");?
Code to instantiate a new String named str with the value "hi" and a static type of Comparable
Big O for foo
public int foo(int n) {
int result = 0;
for (int i = 0; i < n; i++) {
for (int j = 0; j < 10000; j++) {
result += i + j;
}
}
return result;
}
What is O(n)?
Where the target element would be for the worst case of binary search
What is the first or last index?
Letting the program crash is not an option for this kind of Exception
What is a Checked Exception?