5 Written questions
5 Matching questions
- What is the Big O of inserting at the front of an array or an ArrayList?
- In a Cons list, first and rest have different types. What are they?
- With respect to linked lists, what does .set(idx, element) do?
- To compare against null, what should be used?
- What is inorder?
- a Replaces the element at the specified position in this list with the specified element.
- b an order of processing a tree in which the parent node is processed in between its children
- c O(N)
- d First can be any Object type, while rest is a Cons or null
- e == or !=
5 Multiple choice questions
- add and remove are O(N) for random positions, contains is O(N)
- O(N). Much, much better.
- It concatenates two lists to form a single list.
(append '(a b c) '(d e)) = (a b c d e)
- ordering that can guarantee to terminate (go down to zero)
- getFirst, addFirst, removeFirst, getLast, addLast, removeLast are all O(1)
5 True/False questions
What is a constructive function? → A function that creates a new list, but does not modify the original list's arguments
How can you find the Big O of a loop? → The loop count times the Big O of the contents
How many children can a node have? → Any number
What are the different representations of trees that we are concerned with for Novak's class? → Binary trees, First-Child/Next-sibling, Linked lists, Implicit
What is a parent? → A kind of graph composed of nodes and links. It has one root node. Each node except the root has exactly one parent. All nodes are reachable from the root.