htb

package
v0.0.0-...-d4adc71 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 19, 2024 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// multiple of two
	MaxSlotSize = 8
	// better if bucket size multiple of 2
	DefaultBucketSize = MaxSlotSize
)

Variables

This section is empty.

Functions

This section is empty.

Types

type HTB

type HTB struct {
	// contains filtered or unexported fields
}

Implement simple hash table (not thread safe). Inspired from Go Map type implem (very simplified). I guess it is common approach but I looked example in Go source code. hash table (where key/value a string type) size of buckets should be multiple of 8 number slots in bucket 8 when slot overflow double size of buckets bucket size never reduced (after delete key)

func NewHTB

func NewHTB(size int) *HTB

func (*HTB) Add

func (t *HTB) Add(k, v string)

func (*HTB) Del

func (t *HTB) Del(k string)

func (*HTB) Get

func (t *HTB) Get(k string) (string, bool)

return value and find status

func (*HTB) Len

func (t *HTB) Len() int

func (*HTB) String

func (t *HTB) String() string

just for debug

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL