Update heapq description

This commit is contained in:
TJ Pavaritpong committed 2022-11-21 18:13:19 -06:00
1 parent cba7da3f8c
commit 4e4a82e08f
1 file changed
+1 -1
+1 -1
View File
@@ -300,7 +300,7 @@ heapq.heapify(myList)
x = heapq.heappop(myList)
print(-x) # => 9 (making sure to multiply by -1 again)
```
Heaps are binary trees for which every parent node has a value less than or equal to any of its children. Useful for accessing min/max value quickly. See: [Heapq](https://docs.python.org/3/library/heapq.html)
Heaps are binary trees for which every parent node has a value less than or equal to any of its children. Useful for accessing min/max value quickly. Time complexity: O(n) for heapify, O(log n) push and pops. See: [Heapq](https://docs.python.org/3/library/heapq.html)
### Stacks and Queues {.row-span-3}
```python