hashtable

package
v0.0.0-...-e595a67 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HashTable

type HashTable struct {
	Capacity int
	// contains filtered or unexported fields
}

HashTable is a data structure

func New

func New(size int) *HashTable

New is a constructor for the HashTable structure

func (*HashTable) Add

func (table *HashTable) Add(item *KeyValuePair) (bool, error)

Add is a method to and a new item to the table

func (*HashTable) Get

func (table *HashTable) Get(key int) interface{}

Get returns a value of a specific key

func (*HashTable) Print

func (table *HashTable) Print()

Print is a test method for printion all the table

func (*HashTable) Remove

func (table *HashTable) Remove(key int) (bool, error)

Remove is a methid, which removes an item with specific key

type KeyValuePair

type KeyValuePair struct {
	Key   int
	Value interface{}
	Next  *KeyValuePair
}

KeyValuePair is a data structude for a Chaining Hash Table

func NewKeyValuePair

func NewKeyValuePair(key int, value interface{}) *KeyValuePair

NewKeyValuePair is a constructor for the KeyValuePair structure

Jump to

Keyboard shortcuts

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