[issue35659] Add heapremove() function to heapq

2019-01-04 Thread Tim Peters
Tim Peters added the comment: For history, note that `bisect` doesn't always work in this context either: a heap is NOT always in sorted order. For example, this is "a (min) heap" too: [1, 3, 2]. More, that's "the real" problem. If we could find the element to be removed in log(n) time,

[issue35659] Add heapremove() function to heapq

2019-01-04 Thread Wanja Chresta
Wanja Chresta added the comment: After thinking about it some more I realised that this doesn't make sense since heapq is based on lists and lists have an insertion complexity of O(n). Thus, they'll never read the needed O(log n) and heapq is the wrong place. Never mind. -- resoluti

[issue35659] Add heapremove() function to heapq

2019-01-04 Thread Wanja Chresta
Change by Wanja Chresta : -- type: -> enhancement ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://ma

[issue35659] Add heapremove() function to heapq

2019-01-04 Thread Wanja Chresta
New submission from Wanja Chresta : Heap Queues are extremely useful data structures. They can, for example, be used to implement Dijkstra's algorithm for finding the shortest paths between nodes in a graph in O(edge * log vertices) time instead of (edge * vertices) without heaps. One operat