You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current API docs on Heap provide useful information about its implementation details, but the docs don't explain what a heap is and why one would want to use it. We should add an introduction that is useful for a wider audience, moving the current documentation into an 'Implementation Details' section.
Something like this would be a good start:
A collection of comparable items arranged in a way that allows efficient access to its minimal and maximal elements.
Heaps can be used to efficiently provide sorted access to items that arrive incrementally and out of order. For example, a server application may use a heap to store its queue of incoming client transactions, processing them in order of decreasing priority.
Heaps provide highly optimized implementations for the following operations:
insert(_:): Inserts a new element in O(log(count)) time.
min()/max(): Retrieve (but does not remove) the minimum/maximum item in O(1) time.
removeMin()/removeMax(): Remove and return the minimum/maximum item in O(log(count)) time.
<Some toy sample code illustrating these operations>
The text was updated successfully, but these errors were encountered:
The current API docs on
Heap
provide useful information about its implementation details, but the docs don't explain what a heap is and why one would want to use it. We should add an introduction that is useful for a wider audience, moving the current documentation into an 'Implementation Details' section.Something like this would be a good start:
The text was updated successfully, but these errors were encountered: