CMSC132 Midterm 2
Big O Notation Ordering - answerO(1), O(log n), O(n), (n log n), O(n^2), O(n^3), O(2^n),
O(3^n), O(n!), O(n^n)
Array generics work-around - answer private T[] b = (T[]) new Object[4];
Inserting or deleting anything in an array is big - O of - answern
Syntax for parameterized type where T must be a subtype of Foo - answer<T extends
Foo>
is String[] a subtype of Object[] in Java? - answer Yes
Use a wildcard to denote "anything that extends athlete" - answer<? extends athlete>
Linear data structures - answerArray, Linked List, Doubly Linked List
Examples of abstract data types - answerList, Stack, Queue, Dequeue, Set, Map, Tree,
Priority Queue
Inserting before a cursor in a singly-linked list is big-O of - answer1
Deleting at cursor on a singly linked list is big-O of - answer1
The DE in Dequeue stands for - answerDouble ended
Queues are usually implemented using - answerLinked List and arrays
Dequeues are usually implemented using - answerDoubly Linked Lists and arrays
Load factor equation - answernumber of elements / size of the table
What is the max load factor? - answer0.75
What formula do we use to pick which bucket to add an element to? - answerbucket =
hash code % array length
What is the Java HashCode contract - answerif two objects are "equal," they must be
assigned the same hashcode
If you override equals() what else should be overridden? - answerhashCode()
Big O Notation Ordering - answerO(1), O(log n), O(n), (n log n), O(n^2), O(n^3), O(2^n),
O(3^n), O(n!), O(n^n)
Array generics work-around - answer private T[] b = (T[]) new Object[4];
Inserting or deleting anything in an array is big - O of - answern
Syntax for parameterized type where T must be a subtype of Foo - answer<T extends
Foo>
is String[] a subtype of Object[] in Java? - answer Yes
Use a wildcard to denote "anything that extends athlete" - answer<? extends athlete>
Linear data structures - answerArray, Linked List, Doubly Linked List
Examples of abstract data types - answerList, Stack, Queue, Dequeue, Set, Map, Tree,
Priority Queue
Inserting before a cursor in a singly-linked list is big-O of - answer1
Deleting at cursor on a singly linked list is big-O of - answer1
The DE in Dequeue stands for - answerDouble ended
Queues are usually implemented using - answerLinked List and arrays
Dequeues are usually implemented using - answerDoubly Linked Lists and arrays
Load factor equation - answernumber of elements / size of the table
What is the max load factor? - answer0.75
What formula do we use to pick which bucket to add an element to? - answerbucket =
hash code % array length
What is the Java HashCode contract - answerif two objects are "equal," they must be
assigned the same hashcode
If you override equals() what else should be overridden? - answerhashCode()