Last active
July 17, 2019 10:47
-
-
Save onemouth/0631b2ff53e1ae2a98571fe50ea30ac0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func (m *Map) Get(key string) string { | |
hash := int(m.hash([]byte(key))) | |
idx := sort.Search(len(m.keys), | |
func(i int) bool { return m.keys[i] >= hash } | |
) | |
if idx == len(m.keys) { | |
idx = 0 | |
} | |
return m.hashMap[m.keys[idx]] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment