#Hash tables help

11 messages · Page 1 of 1 (latest)

ocean jolt
#

could someone explain how code gets the hash values for each string?

summer violetBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

boreal portal
#

I would guess it's grabbing the last character and finding its position in the alphabet

random juniper
boreal portal
#

Oh I didn't see it gave the actual implementation lol, I thought you needed to do that

ocean jolt
#

thank you

boreal portal
#

Yeah so strlen(str) finds the length of the string, then 1 is subtracted from it, since arrays are zero indexed. That gets you the index of the last character. Then the character is converted to lowercase and 'a' is subtracted

ocean jolt
#

I was over thinking it since the str[index] had me confused

#

!solved