mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-09 03:34:02 +08:00
updaye 0232.用栈实现队列:添加复杂度分析
This commit is contained in:
@ -112,6 +112,10 @@ public:
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
* 时间复杂度: push和empty为O(1), pop和peek为O(n)
|
||||||
|
* 空间复杂度: O(n)
|
||||||
|
|
||||||
|
|
||||||
## 拓展
|
## 拓展
|
||||||
|
|
||||||
可以看出peek()的实现,直接复用了pop(), 要不然,对stOut判空的逻辑又要重写一遍。
|
可以看出peek()的实现,直接复用了pop(), 要不然,对stOut判空的逻辑又要重写一遍。
|
||||||
|
Reference in New Issue
Block a user