A space efficient data structure to store and look-up through a large set of (uniformly distributed) Integers

后端 未结 7 2197
悲哀的现实
悲哀的现实 2021-01-06 22:28

I\'m required to hold, in memory, and look-up through one million uniformly distributed integers. My workload is extremely look-up intensive.
My current implementation u

7条回答
  •  南方客
    南方客 (楼主)
    2021-01-06 22:44

    Sounds like you could just keep a sorted int[] and then do a binary search. With a million values, that's ~20 comparisons to get to any value - would that be fast enough?

提交回复
热议问题