[chuck-users] object / class hacking

Hans Aberg haberg at math.su.se
Wed Sep 30 05:03:01 EDT 2009


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




More information about the chuck-users mailing list