- Please implement
MaxPQ
based on an unordered array and ordered array, respectively.
- Do exercise 1 using a linked list.
- Please prove that the height of a complete binary tree of size N is \(\lfloor \lg{N} \rfloor\).
- Please implement the minimum binary heap (
MinPQ
).
- Please design an algorithm to test whether a maximum binary heap is valid.
- Given the
Book
class, please compare books by the price first, and then by the length of titles if the prices are identical.
- Please implement the
MaxPQ
with a user-defined comparator in Python.
- Please implement a binary heap using explicit links. Hint: you shall use left, right, and parent as we did in a RBT.
- How to use PriorityQueue or heapq as a minimum heap?
- Please design an algorithm to sort a list based on the heap.
- Please give the time analysis for swim-based heap construction.