23 Nov
2017
23 Nov
'17
3:02 a.m.
Grant Jenks wrote:
The heap algorithm is exposed through a high-level functional interface so that you can take advantage of duck-typing.
This would also be true of a HeapWrapper class that wrapped an existing sequence. There's a difference between the heap functions and sorted(). The latter is just a single function that does its job and returns a result. But the heap interface is a collection of functions that have to be used together in the right way to maintain the heap invariants. That suggests some encapsulation is in order. -- Greg