avl

package
v0.0.3-alpha Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2021 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package avl is a Adelson-Velskii and Landis tree implemnation avl is self-balancing tree, i.e for all node in a tree, height difference between its left and right child will not exceed 1 more information : https://en.wikipedia.org/wiki/AVL_tree

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(root **Node, key int)

Delete : remove given key from the tree

func Insert

func Insert(root **Node, key int)

Insert a new item

Types

type Node

type Node struct {
	Key         int
	Height      int
	Left, Right *Node
}

Node of a tree

func Get

func Get(root *Node, key int) *Node

Get : return node with given key

func NewTree

func NewTree() *Node

NewTree create a new AVL tree

Jump to

Keyboard shortcuts

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