mirror of
https://github.com/autistic-symposium/master-algorithms-py.git
synced 2025-04-29 20:26:07 -04:00
Create heapify.py
This commit is contained in:
parent
cf0a3cd358
commit
e8882c2da0
11
heaps/heapify.py
Normal file
11
heaps/heapify.py
Normal file
@ -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)
|
Loading…
x
Reference in New Issue
Block a user