一、循环队列
1、头指针front,尾指针rear
当rear > front时,元素个数为rear - front;
当rear <= front时,元素个数为rear-front+capacity;
综上述两种情况,可得元素个数为(rear-front+capacity)%capacity,其中capacity表循环队列容量。
二、排序
三、查找
一、循环队列
1、头指针front,尾指针rear
当rear > front时,元素个数为rear - front;
当rear <= front时,元素个数为rear-front+capacity;
综上述两种情况,可得元素个数为(rear-front+capacity)%capacity,其中capacity表循环队列容量。
二、排序
三、查找