by ComputerGuru · 13y ago · 0 comments
* How many times will you look for each number?
* How big is the original data?
* How sorted is the original data?
* What kind of access patterns do you have for lookups? (i.e. are the lookups themselves sorted)
* Are there perhaps special space constraints to consider that may have priority over time constraints?
* Where/how is the data stored/how is it backed? (perhaps you're reading from tape media or other non-random-access-optimized storage)
* Is the data a set or bag? (duplicate values allowed, do you care which one is returned, etc)
What exactly are the tradeoffs of adding an index?
If the array of numbers is mutable, the index also needs to be a modifiable structure (like a tree).