mirror of
https://github.com/onyx-and-iris/grokking-algorithms.git
synced 2024-11-16 01:40:53 +00:00
13 lines
309 B
Python
13 lines
309 B
Python
|
from queue import PriorityQueue
|
||
|
|
||
|
customers = (
|
||
|
PriorityQueue()
|
||
|
) # we initialise the PQ class instead of using a function to operate upon a list.
|
||
|
customers.put((2, "Harry"))
|
||
|
customers.put((3, "Charles"))
|
||
|
customers.put((1, "Riya"))
|
||
|
customers.put((4, "Stacy"))
|
||
|
|
||
|
while customers:
|
||
|
print(customers.get())
|