Heap
Heap data structure,Gives a feel like using priority queue in Java and C++.
crete instance Heap(List,Key) Key can be any lambda or other function
Eg:-
l =[[0,30],[15,20],[5,10]]
heap = Heap(l,key = lambda x:-(x[0]*x[0]+x[1]*x[1]))
print(type(heap),heap)
heap.show()
while heap.size():
print(heap.pop())
Installation
pip install saral-square
How to use it?
Import it in python script and use by creating Heap class Instance
License
© 2021 Pritam Sarkar
This repository is licensed under the MIT license. See LICENSE for details.