@ -20,6 +20,7 @@ Implementation of various data structures and algorithms in Go.
- [Maps](#maps)
- [HashMap](#hashmap)
- [TreeMap](#treemap)
- [HashBidiMap](#hashbidimap)
- [Trees](#trees)
- [RedBlackTree](#redblacktree)
- [BinaryHeap](#binaryheap)
@ -53,7 +54,7 @@ type Container interface {
Containers are either ordered or unordered. All ordered containers provide [stateful iterators](#iterator) and some of them allow [enumerable functions](#enumerable).
A BidiMap is an extension to the Map. A bidirectional map (BidiMap), also called a hash bag, is an associative data structure in which the key-value pairs form a one-to-one relation. This relation works in both directions by allow the value to also act as a key to key, e.g. a pair (a,b) thus provides a coupling between 'a' and 'b' so that 'b' can be found when 'a' is used as a key and 'a' can be found when 'b' is used as a key.
```go
type BidiMap interface {
GetKey(value interface{}) (key interface{}, found bool)
Map
}
```
#### HashMap
A [map](#maps) based on hash tables. Keys are unordered.
@ -430,6 +442,35 @@ func main() {
}
```
#### HashBidiMap
A [map](#maps) based on two hashmaps. Keys are unordered.
A tree is a widely used data data structure that simulates a hierarchical tree structure, with a root value and subtrees of children, represented as a set of linked nodes; thus no cyclic links.
@ -1057,6 +1098,10 @@ Collections and data structures found in other languages: Java Collections, C++
- Used in production.
**No dependencies**:
- No external imports.
There is often a tug of war between speed and memory when crafting algorithms. We choose to optimize for speed in most cases within reasonable limits on memory consumption.
Thread safety is not a concern of this project, this should be handled at a higher level.