@Override
    public T dequeue() {
        if(isEmpty())
            throw new NoSuchElementException("Queue Underflow: Queue is empty");
        T value = elements[front];
        elements[front] = null;
        count--;
        front++;
        if(front == elements.length)
            front = 0;
        if(count > 0 && count == elements.length/4)
            expandQueue(2*elements.length);
        return value;
            
    }