CS 200 Final Exam completely solved!!!
linear probing - ANSWERh(key) = (key + j) % n
Improved Linear Probing - ANSWERh(key, c) = [(key + (j * c)] % n
quadratic probing - ANSWERh(key) = [f(key) + j2] mod n
bucket sort - ANSWERsorts using elements as indices, sorting them in an ordered
linked list if elements share an indices
radix sort - ANSWERsorts according to each digit of the value in order starting from
either least significant or most significant digit
merge sort - ANSWERA list is split into individual lists, these are then combined (2 lists
at a time).
quicksort - ANSWERa sorting technique that moves elements around a pivot and
recursively sorts the elements to the left and the right of the pivot
not-in-place partition - ANSWERchoose pivot, move pivot in order, divide list, choose
pivot, move in order, etc.
Double Hashing - ANSWER[h(key) + j * h'(key)] mod n
load factor - ANSWERstopping j when j reaches m / n, so as to prevent O(n) runtime
bubble sort - ANSWERcomparing neighboring elements, swapping with each pass
selection sort - ANSWERscans for largest/smallest elements, swapping with the
element closest to the sorted side
insertion sort - ANSWERone item is added to the sorted side at a time and is placed in
its proper position w/ each pass
in-place paritition - ANSWERusing pivot, h, k
divide and conquer - ANSWERA program design strategy in which tasks are broken
down into subtasks, which are broken down into sub-subtasks, and so on, until each
piece is small enough to code comfortably.
linear probing - ANSWERh(key) = (key + j) % n
Improved Linear Probing - ANSWERh(key, c) = [(key + (j * c)] % n
quadratic probing - ANSWERh(key) = [f(key) + j2] mod n
bucket sort - ANSWERsorts using elements as indices, sorting them in an ordered
linked list if elements share an indices
radix sort - ANSWERsorts according to each digit of the value in order starting from
either least significant or most significant digit
merge sort - ANSWERA list is split into individual lists, these are then combined (2 lists
at a time).
quicksort - ANSWERa sorting technique that moves elements around a pivot and
recursively sorts the elements to the left and the right of the pivot
not-in-place partition - ANSWERchoose pivot, move pivot in order, divide list, choose
pivot, move in order, etc.
Double Hashing - ANSWER[h(key) + j * h'(key)] mod n
load factor - ANSWERstopping j when j reaches m / n, so as to prevent O(n) runtime
bubble sort - ANSWERcomparing neighboring elements, swapping with each pass
selection sort - ANSWERscans for largest/smallest elements, swapping with the
element closest to the sorted side
insertion sort - ANSWERone item is added to the sorted side at a time and is placed in
its proper position w/ each pass
in-place paritition - ANSWERusing pivot, h, k
divide and conquer - ANSWERA program design strategy in which tasks are broken
down into subtasks, which are broken down into sub-subtasks, and so on, until each
piece is small enough to code comfortably.