Fast Algorithm to Quickly Find the Range a Number Belongs to in a Set of Ranges?

后端 未结 5 1618
情书的邮戳
情书的邮戳 2020-11-29 00:53

The Scenario

I have several number ranges. Those ranges are not overlapping - as they are not overlapping, the logical consequence is that no number can be part of

5条回答
  •  长情又很酷
    2020-11-29 01:36

    If the total range of numbers is low, and you have enough memory, you could create a huge table with all the numbers.

    For example, if you have one million of numbers, you can create a table that references the range object.

提交回复
热议问题