Situation:
I want to do a comparison: check if the number is in the list of numbers (a very large list, the length is over 1e ^ 5 or even 2e ^ 5), allowing a + or - 5 error
Example: match 95 on the list [0, 15, 30, 50,60,80,93] → true match 95 on the list [0,15,30,50,60,70,80,105,231,123123,12312314, ...] → false
ps: the list is not sorted (or I can sort it if in this way the efficiency can be increased)
I tried using a dictionary (somekey and list of numbers), but it was too slow when I search the list.
Are there any better ideas? (there are 3000+ numbers that I need to find)
source
share