Chapter04

command
v0.0.0-...-2ded4ce Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2023 License: MIT Imports: 9 Imported by: 0

README

Chapter 4

Non-Linear Data Structures

  • Trees
  • Tables
  • Containers
  • Hash functions
Tree
space usage for a binary search tree is of the order O(n), whereas the insert, search,
and delete operations are of the order O(log n). A binary search tree consists of nodes with
properties or attributes:
  • A key integer
  • A value integer
  • The leftNode and rightNode instances of TreeNode
// TreeNode class
type TreeNode struct {
 key int
 value int
 leftNode *TreeNode
 rightNode *TreeNode
}
// BinarySearchTree class
type BinarySearchTree struct {
 rootNode *TreeNode
 lock sync.RWMutex
}

what is sync.RWMutex Source Code Binary tree

AVL Tree
Tables
// Table Class
type Table struct {
 Rows []Row
 Name string
 ColumnNames []string
}

// Row Class
type Row struct {
 Columns []Column
 Id int
}
// Column Class
type Column struct {
 Id int
 Value string
 }

Circular Linked List

Golang container/ring data type source code

Hash Functions
  • The Common two ways to implement a hash function in Go: with crc32 or sha256.

Documentation

Overview

/main package has examples shown in Go Data Structures and algorithms book

/main package has examples shown in Go Data Structures and algorithms book

main package has examples shown in Hands-On Data Structures and algorithms with Go book

main package has examples shown in Hands-On Data Structures and algorithms with Go book

/main package has examples shown in Go Data Structures and algorithms book

Jump to

Keyboard shortcuts

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