Hash Map

V

Victor Bazarov

Salman said:
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'.

V
 
J

James Kanze

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top