Hans: Of course I'd love to use a hashmap. But how do you get one in Chuck? AFIK, the existing chuckain "hash array" lacks a means to iterate over its contents. - Rob On 30 Sep 2009, at 02:03, Hans Aberg wrote:
On 30 Sep 2009, at 02:13, Robert Poor wrote:
I guess the question should be: what's the fastest way to maintain a *set* of objects (i.e. a collection in which an object may only appear once) with the usual operations for insertion, deletion and iteration?
For lookup tables, if you do not need to compare the keys, a hash map is fastest - time complexity O(1), otherwise a balanced tree (like C++ std::map) - complexity O(log n). There might be some C++ hash map classes at http://www.boost.org/. But if n is small and use not too intense, just about any container will do.
Hans