COSC 311 WINTER 2013 Queue basic ops on linked list (see your text!!) (1) Note! head == tail will be true for two cases: queue empty, and queue has one element. So, use the following to distinguish these cases: if (head == null) { // queue empty } else if (head == tail) { // queue has one element } else { // queue has more than one element } (2) insert to a queue with one or more elements: insert(d) --> use the following: Node n = new Node(d); tail.next = n; tail = n; (3) delete from a queue with more than one element: delete() --> use the following: Node n = head; head = head.next; return n; (4) Note, for other cases (e.g., empty queue), you will do slightly different operations to insert/delete.