From 4e4a82e08f197f0ab1c67945cc1101886e317998 Mon Sep 17 00:00:00 2001 From: TJ Pavaritpong Date: Mon, 21 Nov 2022 18:13:19 -0600 Subject: [PATCH] Update heapq description --- source/_posts/python.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/_posts/python.md b/source/_posts/python.md index ab3af52..88b814c 100644 --- a/source/_posts/python.md +++ b/source/_posts/python.md @@ -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