Wednesday, April 18, 2012

Efficient data structure for GUIDs

I am in search of a data structure which enables me to quickly (prefarably O(1)-quickly) determine if a given GUID is a member of a Collection of GUIDs or not.



My current approach is to use a TDictionary with 0 as values.



While this works quickly, it seems to be a waste to use a Hashmap to rehash a GUID, which is by defintion considered to be unique, and to have the Dictionary handle values which are unneeded.



There must be a better solution for this, but I can't find one. Can you?





No comments:

Post a Comment