- Trees
- Tables
- Containers
- Hash functions
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
// 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
}