firstPerson
Industrious Poster
4,046 posts since Dec 2008
Reputation Points: 851
Solved Threads: 626
Skill Endorsements: 15
why do you have both "put" and "insert" function? Most likely, you should only have one function to insert into the hashmap.
firstPerson
Industrious Poster
4,046 posts since Dec 2008
Reputation Points: 851
Solved Threads: 626
Skill Endorsements: 15
why do you have that? A key should be unique. In your insert function you are shifting values around. That would cause the get method to fail or act incorrectly because a key that was hashed into a slot is no longer in the same slot.
firstPerson
Industrious Poster
4,046 posts since Dec 2008
Reputation Points: 851
Solved Threads: 626
Skill Endorsements: 15
No all you need is a insert function. Usually what happens is that if you try to insert into the map with a key that already exist you return the already existed key/value pair. It is up to the user to decide whether to remove that key or just replace the value associated with that key
firstPerson
Industrious Poster
4,046 posts since Dec 2008
Reputation Points: 851
Solved Threads: 626
Skill Endorsements: 15
Ok so what I need to do is take the key and find the value in the array that matches the key and replace it there. But wouldn't I still have to move the data over to the right and insert the new data into the empty spot?
Key should be unique to each hashtable. So every key of value 5 for example, should map to the same spot in the array.
firstPerson
Industrious Poster
4,046 posts since Dec 2008
Reputation Points: 851
Solved Threads: 626
Skill Endorsements: 15
Question Answered as of 1 Year Ago by
firstPerson