Skip to content Skip to sidebar Skip to footer
Showing posts with the label Heap

Is Min Heap Function

I want to write a function that tells me whether a given list is a min heap. What I have written s… Read more Is Min Heap Function

What Would You Use The Heapq Python Module For In Real Life?

After reading Guido's Sorting a million 32-bit integers in 2MB of RAM using Python, I discovere… Read more What Would You Use The Heapq Python Module For In Real Life?

Descending Order Using Heapq

I am using heapq module of Python get data in ascending and descending order. For ascending, I am u… Read more Descending Order Using Heapq

Looking For An Inverted Heap In Python

I'd like to comb off the n largest extremes from a timeseries. heapq works perfectly for the nl… Read more Looking For An Inverted Heap In Python

Unusual Result From Heappop?

I have a simple heap defined as a list of lists. I was using heapop from the heapq module to extrac… Read more Unusual Result From Heappop?