Consider a lookup function with the following signature, which needs to return an integer for a given string key:
int GetValue(string key) { ... }
What you want is a look-up table of look-up tables. If memory cost is not an issue you can go all out.
const int POSSIBLE_CHARCODES = 256; //256 for ascii //65536 for unicode 16bit
struct LutMap {
int value;
LutMap[POSSIBLE_CHARCODES] next;
}
int GetValue(string key) {
LutMap root = Global.AlreadyCreatedLutMap;
for(int x=0; x