You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On the "Project: HashMap" this paragraph appears (bolding mine).
"You might find yourself confusing keys with hash codes while accessing key-value pairs later. We would like to stress that the key is what your hash function will take as an input. In a way, we could say that the key is important for us only inside the hash function, as we never access a bucket directly with the key. Instead, we always do so with the hash code."
When the concept of duplicate keys that might produce the same hash comes up, the assignment directs the learner to the previous page's Dealing with collisions section, which tells the learner to use a LinkedList inside the bucket, This part was a HUGE hurdle for me until I went to TOP Discord and got help. Because of the bolded statement in the above paragraph, I was under the impression that you were not "supposed to" store the original key string anywhere in the HashMap structure.
"Recall that collisions occur when TWO DIFFERENT keys generate the same hash code and get assigned to the same bucket. (e.g. Rama and Sita are both hashed to 3, so 3 becomes a location for Rama AND Sita. However, we know that this is not an update because the keys are different). Review the dealing with collisions section of the previous lesson to find a way to handle our collisions."
I propose adding a clarifying parenthetical because the linked-to section is inadequate in its explanation, that reads something like: "(In this case, storing the original string keys -- like Rama and Sita -- in the LinkedList will be required to ensure data is not accidentally overwritten.)"
Or maybe the first line about it "only" being important inside the hash() function needs to change?
Checks
Describe your suggestion
On the "Project: HashMap" this paragraph appears (bolding mine).
"You might find yourself confusing keys with hash codes while accessing key-value pairs later. We would like to stress that the key is what your hash function will take as an input. In a way, we could say that the key is important for us only inside the hash function, as we never access a bucket directly with the key. Instead, we always do so with the hash code."
When the concept of duplicate keys that might produce the same hash comes up, the assignment directs the learner to the previous page's Dealing with collisions section, which tells the learner to use a LinkedList inside the bucket, This part was a HUGE hurdle for me until I went to TOP Discord and got help. Because of the bolded statement in the above paragraph, I was under the impression that you were not "supposed to" store the original key string anywhere in the HashMap structure.
"Recall that collisions occur when TWO DIFFERENT keys generate the same hash code and get assigned to the same bucket. (e.g.
Rama
andSita
are both hashed to3
, so3
becomes a location forRama
ANDSita
. However, we know that this is not an update because the keys are different). Review the dealing with collisions section of the previous lesson to find a way to handle our collisions."I propose adding a clarifying parenthetical because the linked-to section is inadequate in its explanation, that reads something like: "(In this case, storing the original string keys -- like
Rama
andSita
-- in the LinkedList will be required to ensure data is not accidentally overwritten.)"Or maybe the first line about it "only" being important inside the hash() function needs to change?
Path
Node / JS
Lesson Url
https://www.theodinproject.com/lessons/javascript-hashmap
(Optional) Discord Name
@ctcsaw / "Connor Thomas Cleary"
(Optional) Additional Comments
Since I haven't contributed before, I didn't feel comfortable just opening a PR without discussing it here first.
The text was updated successfully, but these errors were encountered: