5 Written Questions
5 Matching Questions
- Determine the Big O of the following code:
for ( i = 0; i < n; i++)
for (j = 0; j < n; j++)
sum += a[i][j];
- What is a fair data structure?
- What is a Cons?
- What does it mean for a function to be intractable?
- What is a runtime stack?
- a a stack that keeps a fresh set of values for each variable in a stack frame
- b The function that constructs a pair of pointers
- c O(n²)
- d It can only be computed when n is relatively small (for example, exponential)
- e An entry in a queue will eventually get serviced and removed so a queue is fair
5 Multiple Choice Questions
- It provides a simple lookup tool to find information in a linked list
- In a tree, it is a node that points to a given node
- getFirst, addFirst, removeFirst, getLast, addLast, removeLast are all O(1)
- It tests whether a given item is an element of a list. It returns the remainder of the list beginning with the desired element
- Down arrows represent the first child, while side arrows represent the next sibling
5 True/False Questions
An int is how many bits? → 32
What is the Big O of inserting at the front of a LinkedList? → O(N)
How many children can a node have? → Any number
What is sometimes called a boxed integer? → A function that creates a list but modifies the original list's arguments
What is a linked list? → A data structure where each element has two fields: a link and contents