Data Structures & Algorithms Notes Page
enqueue(x): Add an element x to the rear of the queuedequeue(x): Remove and return an element at the front of the queuepeek(): Return the element at the front of the queue WITHOUT removing itisEmpty(): Check if the queue is empty or notsize(): Return the number of elements in the queue so farLinkedList list;
add(x) {list.add(x)} // RT: O(1)
remove {list.removeFirst()} // RT: O(1)
// In Java:
Queue <E> q = new LinkedList<>()