QUESTIONS 2026 FULLY SOLVED GRADED A+
◉ Number of leaves in decision tree. Answer: n!
◉ Number of decision tree comparisons in worst case. Answer:
Equal to the height of the decision tree
◉ build heap runtime. Answer: 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. Answer: # of keys in hash table / capacity of
hash table
◉ quick sort. Answer: O(n^2) for bad pivot
O(n log n) for median pivot
sorts in place
divide and conquer
◉ merge sort. Answer: O(n log n) worst case
divide and conquer