Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Remove the maximum (max. priority) item */
- public Item delMax() {
- Item max = pq[1]; // 1
- swap(1, length--); // 2
- pq[length + 1] = null; // 3
- if (length > 0 && length == pq.length / 4) { // 4
- resize(pq.length / 2); // 4
- }
- sink(1); // 5
- return max; // 6
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement