On Apr 18, 2:27 am, "Victor Bazarov" <v.Abaza...@comAcast.net> wrote:
> Salman wrote:
> > How can I use Haspmap in C++ and what will be benefit of hashmap over
> > arrays?
> A hash map is what's known as an associative container. It has some
> specific properties that allow quick insertion and retrieval of any
> element. In arrays elements are indexed, in hash maps elements are
> "hashed".
> If you can find an implementation of a hash map, use it. Usually
> you include the header and define your container, just like you would
> a 'vector' or 'list'.
You normally also have to provide a hashing function. This is
non-trivial, and if you don't understand the basic principles of
a hash map (as the original poster obviously doesn't), then the
probability of your writing an effective hashing function is
close to zero.
--
James Kanze (GABI Software) email:
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
|