Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
13
Task/Priority-queue/Python/priority-queue-3.py
Normal file
13
Task/Priority-queue/Python/priority-queue-3.py
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
>>> from heapq import heappush, heappop, heapify
|
||||
>>> items = [(3, "Clear drains"), (4, "Feed cat"), (5, "Make tea"), (1, "Solve RC tasks"), (2, "Tax return")]
|
||||
>>> heapify(items)
|
||||
>>> while items:
|
||||
print(heappop(items))
|
||||
|
||||
|
||||
(1, 'Solve RC tasks')
|
||||
(2, 'Tax return')
|
||||
(3, 'Clear drains')
|
||||
(4, 'Feed cat')
|
||||
(5, 'Make tea')
|
||||
>>>
|
||||
Loading…
Add table
Add a link
Reference in a new issue