update 0225.用队列实现栈:添加复杂度分析
This commit is contained in:
parent
02f9c26f69
commit
1b6e26be2b
|
|
@ -111,6 +111,8 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
* 时间复杂度: push为O(n),其他为O(1)
|
||||||
|
* 空间复杂度: O(n)
|
||||||
|
|
||||||
# 优化
|
# 优化
|
||||||
|
|
||||||
|
|
@ -156,6 +158,9 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
* 时间复杂度: push为O(n),其他为O(1)
|
||||||
|
* 空间复杂度: O(n)
|
||||||
|
|
||||||
|
|
||||||
# 其他语言版本
|
# 其他语言版本
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue