Does python have a sorted list?

前端 未结 7 1885
温柔的废话
温柔的废话 2020-11-29 20:16

By which I mean a structure with:

  • O(log n) complexity for x.push() operations
  • O(log n) complexity to find an element
  • O(n) comple
相关标签:
7条回答
  • 2020-11-29 20:52

    I would use the biscect or sortedcontainers modules. I don't really am experienced, but I think the heapq module works. It contains a Heap Queue

    0 讨论(0)
提交回复
热议问题