Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Insert a new element into the priority queue */
- public void insert(Item data) {
- if (pq.length == length + 1) { // 1
- resize(2 * pq.length); // 1
- }
- pq[++length] = data; // 2
- swim(length); // 3
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement