From e8882c2da0341af28614f26ab4200556d58d2634 Mon Sep 17 00:00:00 2001 From: marina <138340846+bt3gl-cryptographer@users.noreply.github.com> Date: Wed, 2 Aug 2023 12:59:18 -0700 Subject: [PATCH] Create heapify.py --- heaps/heapify.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 heaps/heapify.py diff --git a/heaps/heapify.py b/heaps/heapify.py new file mode 100644 index 0000000..88a7838 --- /dev/null +++ b/heaps/heapify.py @@ -0,0 +1,11 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# author: bt3gl + +import heapq + +min_heap = [3,1,2] +heapq.heapify(min_heap) + +max_heap = [-x for x in min_heap] +heapq.heapify(max_heap)