4 ms·
A good example of an array operation only appropriate for specific states is Python's treatment of heaps: http://docs.python.org/2/library/heapq.html http://do
by kylebgorman 14y ago
A good example of an array operation only appropriate for specific states is Python's treatment of heaps:
http://docs.python.org/2/library/heapq.html http://docs.python.org/2/library/heapq.html
You need to heapify(your_array) in place before, e.g., calling nsmallest(your_array). Not saying that it's good style, but...