priority_queue¶
Module Contents¶
-
class
priority_queue.SpecialSorted(element, value)¶ A helper class to sort the elements of a PriorityQueue
-
__eq__(self, other)¶
-
__ne__(self, other)¶
-
__lt__(self, other)¶
-
-
class
priority_queue.PriorityQueue(sortkey=lambda x: x)¶ Implements a PriorityQueue
-
add(self, item)¶ Add an item to the PriorityQueue
- Parameters
item (obj) – The item to add
-
peek(self)¶ Peeks at the top element
- Returns
the top element of the PriorityQueue
- Return type
obj
-
poll(self)¶ Removes the top element of the PriorityQueue and returns it
- Returns
the top element of the PriorityQueue
- Return type
obj
-
is_empty(self)¶ Returns whether the PriorityQueue is empty
- Returns
True if the PriorityQueue is empty
- Return type
int
-
__str__(self)¶ Returns the string representation of the PriorityQueue
- Returns
a string representation
- Return type
str
-