设队列头指针为 front,队列尾指针为 rear,队列容量为 maxsize

队空:front== rear

队满: (rear+1) mod maxsize == front ( mod 表示求余运算)

队中元素个数 n=(rear-front+maxsize )mod maxsize

入队:rear=(rear+1) % maxsize ;

出队:front=(front+1) % maxsize ;

相关文章:

  • 2022-12-23
  • 2021-08-04
  • 2021-11-26
  • 2021-05-27
  • 2021-07-20
  • 2021-10-20
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-01-10
  • 2021-10-27
  • 2021-09-08
  • 2022-12-23
  • 2022-12-23
  • 2021-04-30
相关资源
相似解决方案