Built a Heap in Cluster algorithm
A heap works in clustering the same way it works outside of clustering.

It's purpose is to efficiently find the minimum or maximum of a set, remove it, then find the next.

Efficient implementations of heaps in scripting languages may be impossible. For good performance, you usually need low-level memory access to avoid copying.