【发布时间】:2013-10-21 04:01:04
【问题描述】:
我在 O(1) 时间内看到了有关使用 findmin 设计堆栈的问题的答案:
https://stackoverflow.com/a/3435998/2653179
如果请求相同怎么办:
Devise a stack-like data structure that does push, pop and min (or max) operations
in O(1) time. There are no space constraints.
但是 deletemin 也应该在 O(1) 中?有可能吗?
【问题讨论】:
-
No
deletemin在 O(1) 中是不可能的。
标签: algorithm data-structures stack