CSE 310 MIDTERM 2 EXAM QUESTIONS
AND ANSWERS 100% PASS
Height of decision tree - ANS h ≥ ceiling( log n! )
Number of leaves in decision tree - ANS n!
Number of decision tree comparisons in worst case - ANS Equal to the height of the decision
tree
build heap runtime - ANS Quick look would say O(n log n) since heapify costs O(log n) and is
called n times. However, the runtime of heapify depends on the height of the tree which starts
off small and grows larger. By accounting for this, can derive a tighter bound of O(n) for building
a heap.
hash table load factor - ANS # of keys in hash table / capacity of hash table
quick sort - ANS O(n^2) for bad pivot
O(n log n) for median pivot
sorts in place
divide and conquer
1 @COPYRIGHT 2025/2026 ALLRIGHTS RESERVED.
AND ANSWERS 100% PASS
Height of decision tree - ANS h ≥ ceiling( log n! )
Number of leaves in decision tree - ANS n!
Number of decision tree comparisons in worst case - ANS Equal to the height of the decision
tree
build heap runtime - ANS Quick look would say O(n log n) since heapify costs O(log n) and is
called n times. However, the runtime of heapify depends on the height of the tree which starts
off small and grows larger. By accounting for this, can derive a tighter bound of O(n) for building
a heap.
hash table load factor - ANS # of keys in hash table / capacity of hash table
quick sort - ANS O(n^2) for bad pivot
O(n log n) for median pivot
sorts in place
divide and conquer
1 @COPYRIGHT 2025/2026 ALLRIGHTS RESERVED.