adding O(logn) for heap deletion