Update heapify.py

This commit is contained in:
bt3gl 2023-08-08 16:34:19 -07:00 committed by GitHub
parent 3d8b77bf80
commit e8c7b716af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,12 +2,6 @@
# -*- coding: utf-8 -*-
# author: bt3gl
# python's built-in heap differs from the standard implementation of a heap
# in two ways. firstly, it uses zero-based indexing, so it stores the root
# node at index zero instead of the size of the heap. secondly, the built-in
# module does not offer a direct way to create a max heap, instead, we must
# modify the values of each eelement when inserting in the heap, and when
# removing it from the heap.
import heapq