Skip to content
Snippets Groups Projects
Unverified Commit d7d4a058 authored by Aditya Aggarwal's avatar Aditya Aggarwal Committed by GitHub
Browse files

Update: usage doc for heappushpop (GH-91451)

parent a573cb2f
No related branches found
No related tags found
No related merge requests found
......@@ -12,6 +12,8 @@
item = heappop(heap) # pops the smallest item from the heap
item = heap[0] # smallest item on the heap without popping it
heapify(x) # transforms list into a heap, in-place, in linear time
item = heappushpop(heap, item) # pushes a new item and then returns
# the smallest item; the heap size is unchanged
item = heapreplace(heap, item) # pops and returns smallest item, and adds
# new item; the heap size is unchanged
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment