n log n, n3, 3n, n/(log n), sqrt(n), log(log n), log n, (log n)2, (log n)sqrt(n), n2log n.
Arranged in order:
log(log n), log n, (log n)2, sqrt(n),
(log n)sqrt(n), n/(log n), n log n, n2log n, n3, 3n.
Data Structure | insert | getMin | reportMax |
---|---|---|---|
sorted array | O(n) | O(1) | O(1) |
unsorted array | O(1) | O(n) | O(1) |
sorted linked list | O(n) | O(1) | O(1) |
unsorted linked list | O(1) | O(n) | O(1) |
We can handle reportMax in O(1) time if we keep an extra variable to hold the current maximum; this max can be updated during insert in O(1) time. We can keep track of the current min in the same way, so reporting the min is easy, but we run into trouble trying to make a fast getMin because of the deletion part of the operation: for an unsorted structure, we would have to search the structure in order to update the current min.