Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Removes an item from the front of the queue, and returns its data */
- public Item dequeue() {
- Item item = q[head]; // 1
- q[head] = null; // 2
- head = (head + 1) % q.length; // 3
- if (length > 0 && length == q.length / 4) { // 4
- resize(q.length / 2); // 4
- } // 4
- length--; // 5
- return item; // 6
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement