Skip to main content

PriorityQueue.peek

Take a look at the root node of the heap

Usage

peek()

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.peek()) # 5print(pq) # [None, 5, 10, 15, 25]