Dennis Lee Bieber <wlfr...@ix.netcom.com> writes: > The first half of the problem description -- "Elements are added at > random" seems more suited to an in-place insertion sort method.
This is precisely what a priority queue is for. Insertions take O(log n) time and there's very little space overhead in heapq's list-based implementation. -- http://mail.python.org/mailman/listinfo/python-list