Hi guys, long time no speak, hope you are all well!
I have come accross a difficult problem with one of my programs:
Given the array:
Index ID Value
0 12 3498
1 34 13
2 50 341
3 900 928
4 1022 32
5 2041 1
...
130m 140b 3401
Where ID is ordered ascending
Where value is unordered
- Where index ranges from 0 to 130 million
- Where ID ranges from 0 to 140 billion
- Where ID is the product of multiple primes
Best way to find index in array with just the ID given?
Any help with this problem is appreciated! Speed is what I am after here, over anything else. Storing each ID in it's coresponding index would create a table of about 6GB, so that's not an option. Binary search would be good, but maybe a bit slow. Hashing as well might cause too large a table as well.
Edited by Gullanian - 22 November 2006 at 4:06pm