











Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!












TOTAL POINTS
QUESTION 1
✓ + 2 pts Correct $$O(n^2)$$
QUESTION 2
✓ + 2 pts Correct $$O(n^2)$$
QUESTION 3
QUESTION 4
✓ + 2 pts Correct $$O(kn)$$
QUESTION 5
QUESTION 6
✓ + 1 pts Partial credit ✓ + 0 pts Incorrect
QUESTION 7
✓ + 2 pts Correct $$O(mn)$$
QUESTION 8
✓ + 3 pts LSD Radix Sort
QUESTION 9
✓ + 3 pts QuickSort
QUESTION 10
✓ + 3 pts Cocktail Shaker Sort
QUESTION 11
✓ + 1 pts f[0] = 0 ✓ + 1 pts f[1] = 1 ✓ + 1 pts f[2] = 0 ✓ + 1 pts f[3] = 1 ✓ + 1 pts f[4] = 2
QUESTION 12
12 Rabin-Karp Rolling Hash 3 / 10
QUESTION 13
13 Quicksort Diagramming 9.5 / 10
✓ + 1 pts exactly 4 swaps occured (8 elements circled) ✓ + 1.5 pts 78 and 71 are swapped (Pivot Swap)
✓ + 1.5 pts 65b and 82a are swapped ✓ + 1.5 pts 72 and 84 are swapped ✓ + 1.5 pts 72 and 78 are swapped
✓ + 1 pts left sub array is in order: 72, 65b, 65a, 71 (it is okay if 78 is last)
✓ + 1 pts right sub array is in order: 84, 82b, 82a, 88 (it is okay if 78 is first)
QUESTION 14 14 Boyer-Moore Galil Diagramming 9.5 /
QUESTION 16
16 HashMap Coding 10.5 / 12 ✓ + 1 pts Checks if key == null ✓ + 0.5 pts If key == null, throws IllegalArgumentException
✓ + 1.5 pts Takes the hash of the key (i.e. key.hashCode()) ✓ + 1 pts Attempts to handle hashes >= capacity (e.g. mod) ✓ + 0.5 pts Mods the hash by table.length
Math.abs)✓ + 1 pts Sets a current reference to the head of a chain ✓ + 1 pts Has a loop that continue while current != null ✓ + 1 pts Checks if current.key.equals(key)
✓ + 1 pts If key match, returns current.value ✓ + 1 pts Sets current = current.next ✓ + 1 pts If no keys match, throws NoSuchElementException
QUESTION 17 17 AVL Coding 5.5 / 15 ✓ + 1 pts Creates a helper method ✓ + 1 pts Calls a helper method ✓ + 1 pts Helper method has a base case ✓ + 1 pts Method avoids NullPointerException ✓ + 2.5 pts Checks the Balance Factor of the current node (or compares the heights of its children or depth of curr to height of root)
QUESTION 18
18 Bonus 1 / 0
✓ + 1 pts literally anything is drawn
Page 5