I have a some data that needs to be stored and looked up efficiently. Preferably using C. Each line of the data file is in the following format:
key1 key2 key3 data
where key1
, key2
, key3
are integers and data
is an array of float
.
I am thinking about converting key1,2,3 into a string, then use C++ std::map
to map string to a float pointer:
std::map<string, float*>
Are there better ways of doing it?
Note: integer key1,2,3 has a range of 0-4000, but very sparsely populated. In another word if you go through all the values in key1, you will find < 100 unique int within the rang eof 0-4000.