Skip to main content

PriorityQueue.search

Check if an item is present in the heap

Usage

search(item:Any)

Parameters:
      item : element
            Item to be searched for

Returns:
      Boolean
            True if the item is present in 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.search(15)) # Trueprint(pq.search(14)) # False