Skip to content

Commit 84c2fff

Browse files
authored
Update linear-data-structure.md
1 parent a843706 commit 84c2fff

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docs/cs-basics/data-structure/linear-data-structure.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ myStack.pop();//报错:java.lang.IllegalArgumentException: Stack is empty.
295295
顺序队列中,我们说 `front==rear` 的时候队列为空,循环队列中则不一样,也可能为满,如上图所示。解决办法有两种:
296296

297297
1. 可以设置一个标志变量 `flag`,当 `front==rear` 并且 `flag=0` 的时候队列为空,当`front==rear` 并且 `flag=1` 的时候队列为满。
298-
2. 队列为空的时候就是 `front==rear` ,队列满的时候,我们保证数组还有一个空闲的位置,rear 就指向这个空闲位置,如下图所示,那么现在判断队列是否为满的条件就是:`(rear+1) % QueueSize= front`
298+
2. 队列为空的时候就是 `front==rear` ,队列满的时候,我们保证数组还有一个空闲的位置,rear 就指向这个空闲位置,如下图所示,那么现在判断队列是否为满的条件就是:`(rear+1) % QueueSize==front`
299299

300300
### 4.3. 常见应用场景
301301

0 commit comments

Comments
 (0)