how to design a data structure that getMedian and insert in O(1)?

前端 未结 0 1084
庸人自扰
庸人自扰 2021-01-25 02:05

I thought about doing this in sort array and save the index of the median and its takes O(1). but I couldn\'t think about any way to do the insert in O(1) and keep the array sor

相关标签:
回答
  • 消灭零回复
提交回复
热议问题