From 2eaf3005cbb1c29d2c1727f09c52bd04d82a7509 Mon Sep 17 00:00:00 2001 From: Phakthima Thongpeng Date: Wed, 12 Oct 2022 20:54:54 +0700 Subject: [PATCH] add exercise heaps --- heaps.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 heaps.py diff --git a/heaps.py b/heaps.py new file mode 100644 index 0000000..d6ac789 --- /dev/null +++ b/heaps.py @@ -0,0 +1,10 @@ +import heapq + +H = [21,1,45,78,3,5] +# Covert to a heap +heapq.heapify(H) +print(H) + +# Add element +heapq.heappush(H,8) +print(H) \ No newline at end of file