Hash Map

Discussion in 'C++' started by Salman, Apr 18, 2007.

  1. Salman

    Salman Guest

    How can I use Haspmap in C++ and what will be benefit of hashmap over
    arrays?
     
    Salman, Apr 18, 2007
    #1
    1. Advertising

  2. 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'.

    V
    --
    Please remove capital 'A's when replying by e-mail
    I do not respond to top-posted replies, please don't ask
     
    Victor Bazarov, Apr 18, 2007
    #2
    1. Advertising

  3. Salman

    James Kanze Guest

    On Apr 18, 2:27 am, "Victor Bazarov" <> 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
     
    James Kanze, Apr 18, 2007
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Amit Bhatia

    Hash Map slower than Map.

    Amit Bhatia, Oct 8, 2007, in forum: C++
    Replies:
    7
    Views:
    385
    =?UTF-8?B?RXJpayBXaWtzdHLDtm0=?=
    Oct 9, 2007
  2. kl
    Replies:
    7
    Views:
    1,353
    James Kanze
    Jan 1, 2008
  3. navS
    Replies:
    3
    Views:
    544
    Ismo Salonen
    May 9, 2008
  4. rp
    Replies:
    1
    Views:
    596
    red floyd
    Nov 10, 2011
  5. Srijayanth Sridhar
    Replies:
    19
    Views:
    676
    David A. Black
    Jul 2, 2008
Loading...

Share This Page