Representing sparse integer sets?

后端 未结 4 1794
抹茶落季
抹茶落季 2021-01-04 05:47

What is a good way to represent sparse set of integers (really C memory addresses) in a compact and fast way. I already know about the obvious things like bit-vectors and ru

4条回答
  •  爱一瞬间的悲伤
    2021-01-04 06:30

    If all you need is insertion, deletion, and test for membership, then a hash table should suit you nicely. You can find some good hash functions for hashing 32-bit integers here.

提交回复
热议问题