A set is a C++ container that stores unique elements. The C++ Standard Template library (STL) defines a C++ template
set<T> that is typically implemented as a binary search tree.
But the GNU C++ library also provides a (non-standard) hash-based set:
In the following code I've created some random #rs numbers and I print the time needed to insert/remove them from a (GNU/hash_set or STL ) set:
$ g++ -Wall -O3 testset.cpp $ ./a.out Time: 109.27seconds.
GNU hash_set version
$ g++ -DWITH_HASHSET=1 -Wall -O3 testset.cpp In file included from /usr/include/c++/4.6/ext/hash_set:61:0, from jeter.cpp:7: /usr/include/c++/4.6/backward/backward_warning.h:33:2: warning: #warning This file includes at least one deprecated or antiquated header which may be removed (...) $ ./a.out Time: 49.69seconds.