Given a set of n (n < 1000) unique bit arrays (for example c++ std::bitset class template) of length l (l > 64), which is the simplest mapping to store such bit arrays in a lookup table L with elements from 0 to n-1?
What I want to achieve is the following:
L["000010001 ... 00101010"] = 0
L["111000000 ... 01000100"] = 1
...
L["001101100 ... 01010111"] = n-1
The bit arrays, if converted to decimals, are not ordered.
I am currently using std::unordered_map<std::bitset<81>, int> and std::unordered_map::find but I have a feeling that there is a faster way to do it.
Aucun commentaire:
Enregistrer un commentaire