mirror of
https://github.com/krahets/hello-algo.git
synced 2026-04-04 11:10:21 +08:00
build
This commit is contained in:
@@ -1098,8 +1098,8 @@ comments: true
|
||||
|
||||
基于此设计,**数组中包含元素的有效区间为 [front, rear - 1]**,进而:
|
||||
|
||||
- 对于入队操作,将输入元素赋值给 `rear` 索引处,并将 `queSize` 增加 1 ;
|
||||
- 对于出队操作,只需将 `front` 增加 1 ,并将 `queSize` 减少 1 ;
|
||||
- 对于入队操作,将输入元素赋值给 `rear` 索引处,并将 `queSize` 增加 1 。
|
||||
- 对于出队操作,只需将 `front` 增加 1 ,并将 `queSize` 减少 1 。
|
||||
|
||||
可以看到,入队和出队操作都只需进行一次操作,时间复杂度均为 $O(1)$ 。
|
||||
|
||||
|
||||
Reference in New Issue
Block a user