插入到5,当前队列容量capacity6, front = 0, 队首插入数据时,front更新为front = (front - 1 + capacity) % capacity = (0 - 1 + 6) % 6 = 5
插入到5,当前队列容量
capacity
6,front
= 0, 队首插入数据时,front
更新为front = (front - 1 + capacity) % capacity = (0 - 1 + 6) % 6 = 5