Tag Archives: heapq

Sort python dictionaries by values

Perhaps you already encountered a problem like the following one yourself: You have a large list of items (let’s say URIs for this example) and want to sum up how often they were viewed (or edited or… whatever). A small … Continue reading

Posted in Coding | Tagged , , , , , , , , | 2 Comments

Min-Heap in Python

I recently wanted to implement a small event system where events can have different priorities. So for example the event with highest priority (lowest value) should be handled first. Python comes with a heapq module which can transform a list … Continue reading

Posted in Coding | Tagged , , , , , , | 4 Comments