August 2019
Beginner to intermediate
798 pages
17h 2m
English
The Go code of hashTable.go, which will be presented in five parts, will help to clarify many things about hash tables.
The first part of hashTable.go is as follows:
package main
import (
"fmt"
)
const SIZE = 15
type Node struct {
Value int
Next *Node
}
In this part, you can see the definition of the node of the hash table, which, as expected, is defined using a Go structure. The SIZE constant variable holds the number of buckets of the hash table.
The second segment from hashTable.go is shown in the following Go code:
type HashTable struct {
Table map[int]*Node
Size int
}
func hashFunction(i, size int) int {
return (i % size)
}
In this code segment, you can see the implementation of the hash function used ...
Read now
Unlock full access