Skip to content

数据结构前置知识——《【动画模拟】栈和队列详解》一文中有个计算错误 #27

Description

@DEROOCE
然后我们再根据以下公式则能够判断队列满没满了。

(rear+1)%queuesize==front

queuesize,代表队列的长度,上图为5。我们来判断上面两张图是否满。(4+1)%5==0,(1+1)%5==3

两种情况都是满的,over。

在循环队列一节中,最后判断队列是否已满,(1+1)%5==3的计算结果应为2.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions