Skip to content

leonardo-bartoli/rbtree

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Red-Black tree golang implementation

Golang implementation of a rb tree data structure.

go get github.com/leonardo-bartoli/rbtree

API

Types

Tree Node key must implement the Key interface:

type Key interface {
	Compare(k Key) int
	Equals(k Key) bool
}

Tree Values are empty interface.

type Value interface{}

Tree IterFunc are function suited to iterate over tree node

type IterFunc func(node *Node, fn NodeFunc)

tree.NEW() *tree.Tree

return a new Tree

(tree *Tree) First() *Node

return a pointer to the first tree Node

(tree *Tree) Last() *Node

return a pointer to the last tree Node

TODO:

  • write a script to generate specialized rbtree implementation,
  • improve documentation.

About

golang red-black tree implementation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages