MCPcopy Create free account
hub / github.com/ua-nick/Data-Structures-and-Algorithms / Set

Method Set

HashTable/HashTable.go:40–51  ·  view source on GitHub ↗
(key string, value int)

Source from the content-addressed store, hash-verified

38}
39
40func (table *HashTable) Set(key string, value int) bool {
41 position := generateHash(key)
42 current := table.data[position]
43 for current != nil {
44 if current.key == key {
45 current.data = value
46 return true
47 }
48 current = current.next
49 }
50 return false
51}
52
53func (table *HashTable) Remove(key string) bool {
54 position := generateHash(key)

Callers

nothing calls this directly

Calls 1

generateHashFunction · 0.85

Tested by

no test coverage detected