canopy

package module
v0.0.0-...-4b1cb01 Latest Latest
Warning

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

Go to latest
Published: May 11, 2024 License: Unlicense Imports: 1 Imported by: 0

README

Canopy

A collection of tree data structures. This is a repo for learning how structure go projects.

Package binary

Contains a collection of binary trees.

Example usage:

tree := binary.NewBinarySearchTree[int]()
binary.InsertAll(tree, 3, 2, 4)
printer := func(n binary.Node[int]) bool {
fmt.Println("node value: ", n.Value())
return true
}
tree.Traverse(binary.InOrder[int], printer)
Binary Search Tree

A standard binary search tree.

Resources
Splay Tree

A Splay Tree is a binary tree which has the following properties:

  • Binary tree
  • Not necessarily balanced
  • Any node with the most recent access is brought to the root
Resources
Red Black Tree

A self-balancing binary tree.

Resources

https://www.cs.usfca.edu/~galles/visualization/RedBlack.html

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Tree

type Tree[E cmp.Ordered] interface {
	// Insert Places a value into the tree.
	// Returns true if the value was inserted, false if the value exists already.
	Insert(value E) bool

	// Delete Removes a value into the tree.
	// Returns true if the value was removed.
	Delete(value E) bool

	// Find Returns true if a value exists in the tree.
	Find(value E) bool
}

Tree The interface for all tree types.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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