Trims the capacity of the heap to the heap's current size.
Trims the capacity of the heap to the heap's current size.If the capacity is actually decreased, this function has a time complexity of O(N), with N being the number of elements in the heap.