About 186,000 results
Open links in new tab
  1. In Python, heapq.heapify doesn't take cmp or key functions as …

    In Python, heapq.heapify doesn't take cmp or key functions as arguments like sorted does Asked 14 years, 1 month ago Modified 1 year, 2 months ago Viewed 66k times

  2. Understanding how to create a heap in Python - Stack Overflow

    Oct 5, 2012 · 35 The collections.Count.most_common function in Python uses the heapq module to return the count of the most common word in a file, for instance. I have traced through the …

  3. python - heapq with custom compare predicate - Stack Overflow

    I am trying to build a heap with a custom sort predicate. Since the values going into it are of "user-defined" type, I cannot modify their built-in comparison predicate. Is there a …

  4. What is Python's heapq module? - Stack Overflow

    From the book Python Module of the Week under paragraph 2.2 Sorting it is written If you need to maintain a sorted list as you add and remove values, check out heapq.

  5. python - How to make heapq evaluate the heap off of a specific ...

    Oct 17, 2010 · 124 I wish to hold a heap of objects, not just numbers. They will have an integer attribute in them that the heap can sort by. The easiest way to use heaps in python is heapq, …

  6. What do I use for a max-heap implementation in Python?

    Python includes the heapq module for min-heaps, but I need a max-heap. What should I use for a max-heap implementation in Python?

  7. Python heapify() time complexity - Stack Overflow

    Aug 8, 2018 · Python heapify () time complexity Asked 7 years, 3 months ago Modified 1 year, 9 months ago Viewed 23k times

  8. Python: Using heap commands on a list of tuples

    Oct 23, 2012 · I'm trying to understand some of Python's built in heap functionality. It seems to not like things when I pass in a list of tuples (or more likely, I'm not passing the list in correctly). …

  9. How to maintain dictionary in a heap in python? - Stack Overflow

    Feb 10, 2013 · If you are using heapq, to create the heap, you need nlogn operations, if you are building a heap by inserting the elements or logn if you heapify a list, followed by mlogn …

  10. Heapify python method in a list of tuples - Stack Overflow

    Oct 16, 2018 · 11 I'm tryng to figure out how I can use heapify function in a list of tuples. i want it for djikstra algorithm so my list will look like this.