function Heap.Pop(h)local k=h[1]h[1]=h[#h]h[#h]=nil h:_HeapifyTopDown(1)return k end
--[[ @brief Removes and returns the smallest element on the heap.
     @return The smallest element on the heap (using the stored comparator function).
--]]
function Heap:Pop()
	local v = self[1]
	self[1] = self[#self]
	self[#self] = nil
	self:_HeapifyTopDown(1)
	return v
end
