insert, delete, max in O(1)

后端 未结 8 1135
北海茫月
北海茫月 2020-11-29 17:42

Can someone tell me which data structure supports insert/delete/maximum operation in O(1)?

8条回答
  •  既然无缘
    2020-11-29 18:13

    If you are using only comparisons, you would be hard pressed to find such a data structure.

    For instance you could insert n elements, get max, delete max etc and could sort numbers in O(n) time, while the theoretical lower bound is Omega(nlogn).

提交回复
热议问题