Skip to main content

PriorityQueue.extract

Returns and remove the root node of the heap

Usage

extract()

Returns:
      element
            Root node of the heap

Example

from jellybeans.structures import PriorityQueue as PQpq = PQ(comparator=lambda x,y: x<=y) # Min heappq.insert(10)pq.insert(5)pq.insert(15)pq.insert(25)print(pq.extract()) # 5print(pq) # [None, 10, 25, 15]