1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Looking for suitable datastructure

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

  1. Slimmy

    Slimmy New Member

    Oct 1, 2010
    Likes Received:
    Trophy Points:

    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)


    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!


Share This Page