Looking for suitable datastructure

Discussion in 'C' started by Slimmy, Oct 1, 2010.

  1. Slimmy

    Slimmy New Member

    Joined:
    Oct 1, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Hi!

    I have an array of doubles that I map to a hashmap to keep track of the indices of the elements. I want to be able to sort the array and still keep track of the indices and thats no problem as long as the elements are distinct. But when I encounter 2 or more elements in the array that are equal my whole scheme fails since they will get the same index.

    I see two solutions to the problem:

    1: Find a way to generate better keys for the elements (dont know how to do this)

    or

    2. Throw out the hashmap and apply a new datastructure that actually does what I want. Anyone got any suggestions on this? Im not to excited about writing my own specific datastructure for this since it's overall a fairly small task that Im working on.

    Thanks for any help!

    Slim
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice