Efficient data structure for fast random access, search, insertion and deletion

前端 未结 8 2093
灰色年华
灰色年华 2021-01-31 11:11

I\'m looking for a data structure (or structures) that would allow me keep me an ordered list of integers, no duplicates, with indexes and values in the same range.

I ne

8条回答
  •  隐瞒了意图╮
    2021-01-31 11:53

    I like balanced binary trees a lot. They are sometimes slower than hash tables or other structures, but they are much more predictable; they are generally O(log n) for all operations. I would suggest using a Red-black tree or an AVL tree.

提交回复
热议问题