Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 55eb649

Browse files
更正 0225.用队列实现栈.md,doc文档错误
时间复杂度错误,修正
1 parent 77e789a commit 55eb649

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

‎problems/0225.用队列实现栈.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ class MyStack:
302302
Python普通的Queue或SimpleQueue没有类似于peek的功能
303303
也无法用索引访问,在实现top的时候较为困难。
304304
305-
用list可以,但是在使用pop(0)的时候时间复杂度为O(1)
305+
用list可以,但是在使用pop(0)的时候时间复杂度为O(n)
306306
因此这里使用双向队列,我们保证只执行popleft()和append(),因为deque可以用索引访问,可以实现和peek相似的功能
307307
308308
in - 存所有数据

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /