Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Add a new item to the back of the queue */
- public void enqueue(Item item) {
- if (q.length == length) { // 1
- resize(2 * q.length); // 1
- } // 1
- q[tail] = item; // 2
- tail = (tail + 1) % q.length; // 3
- length++; // 4
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement