HashTable

package module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2021 License: MIT Imports: 2 Imported by: 0

README

HashTable

Integer key/value implementation of a HashTable in go without using built-in data structure

Documentation

Index

Constants

View Source
const MAP_SIZE = 1000

Variables

This section is empty.

Functions

This section is empty.

Types

type HashMap

type HashMap struct {
	Data []*Node
}

func NewHashMap

func NewHashMap() *HashMap

*

  • Create a new HashMap structure *

func (*HashMap) Get

func (h *HashMap) Get(key int) (int, bool)

*

  • Get an element from the HashMap
  • @param key
  • @param value
  • @return (value, true) if element exists
  • (-1, false) otherwise *

func (*HashMap) Insert

func (h *HashMap) Insert(key int, value int)

*

  • Insert a new element in the HashMap
  • @param key
  • @param value
  • NOTE: collision are handled with linked list *

func (*HashMap) PrintHM

func (h *HashMap) PrintHM()

func (*HashMap) PrintHMbuff

func (h *HashMap) PrintHMbuff()

func (*HashMap) Remove

func (h *HashMap) Remove(key int) (int, bool)

*

  • Remove an element from the HashTable
  • @param key
  • @return (true, val) if elem was removed, (false, -1) if element does not exists

*

type Node

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

func (*Node) PrintNode

func (n *Node) PrintNode() string

Jump to

Keyboard shortcuts

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