Data structure to build and lookup set of integer ranges

前端 未结 7 1626
你的背包
你的背包 2020-12-19 09:58

I have a set of uint32 integers, there may be millions of items in the set. 50-70% of them are consecutive, but in input stream they appear in unpredictable ord

7条回答
  •  南笙
    南笙 (楼主)
    2020-12-19 10:37

    AFAIK there is no such algorithm that search over integer list in O(1).

    One only can do O(1) search with vast amount of memory.

    So it is not very promising to try to find O(1) search algorithm over list of range of integer.

    On the other hand, you could try time/memory trade-off approach by carefully examining your data set (eventually building a kind of hash table).

提交回复
热议问题