From 02f9c26f696774c9db2aa7bef4ac25f9d4b28803 Mon Sep 17 00:00:00 2001 From: Yuhao Ju Date: Sat, 1 Apr 2023 12:42:01 +0800 Subject: [PATCH] =?UTF-8?q?updaye=200232.=E7=94=A8=E6=A0=88=E5=AE=9E?= =?UTF-8?q?=E7=8E=B0=E9=98=9F=E5=88=97=EF=BC=9A=E6=B7=BB=E5=8A=A0=E5=A4=8D?= =?UTF-8?q?=E6=9D=82=E5=BA=A6=E5=88=86=E6=9E=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- problems/0232.用栈实现队列.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/problems/0232.用栈实现队列.md b/problems/0232.用栈实现队列.md index efeb1046..4a57ee96 100644 --- a/problems/0232.用栈实现队列.md +++ b/problems/0232.用栈实现队列.md @@ -112,6 +112,10 @@ public: ``` +* 时间复杂度: push和empty为O(1), pop和peek为O(n) +* 空间复杂度: O(n) + + ## 拓展 可以看出peek()的实现,直接复用了pop(), 要不然,对stOut判空的逻辑又要重写一遍。