We need to store our heap values in such as way that the final value is the highest priority. This will assure we can use pop instead of shift which is much more efficient.
We need to store our heap values in such as way that the final value is the highest priority.
This will assure we can use pop instead of shift which is much more efficient.