tree

package
v0.0.0-...-9e88244 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Node

type Node[T any] struct {
	Val                 T
	Parent, Left, Right *Node[T]
}

func BuildTree

func BuildTree[T any](val []T) (root *Node[T])

func NewNode

func NewNode[T any](val T) *Node[T]

func (*Node[T]) DrawTree

func (n *Node[T]) DrawTree() string

func (*Node[T]) Grandparent

func (n *Node[T]) Grandparent() *Node[T]

func (*Node[T]) HasBothChild

func (n *Node[T]) HasBothChild() bool

func (*Node[T]) HasChild

func (n *Node[T]) HasChild() bool

func (*Node[T]) HasGrandparent

func (n *Node[T]) HasGrandparent() bool

func (*Node[T]) HasLeft

func (n *Node[T]) HasLeft() bool

func (*Node[T]) HasParent

func (n *Node[T]) HasParent() bool

func (*Node[T]) HasRight

func (n *Node[T]) HasRight() bool

func (*Node[T]) HasSibling

func (n *Node[T]) HasSibling() bool

func (*Node[T]) HasUncle

func (n *Node[T]) HasUncle() bool

func (*Node[T]) IsAncestorRelation

func (n *Node[T]) IsAncestorRelation(node *Node[T]) bool

func (*Node[T]) IsChildRelation

func (n *Node[T]) IsChildRelation(node *Node[T]) bool

func (*Node[T]) IsDescendantRelation

func (n *Node[T]) IsDescendantRelation(node *Node[T]) bool

func (*Node[T]) IsGrandparentRelation

func (n *Node[T]) IsGrandparentRelation(node *Node[T]) bool

func (*Node[T]) IsLeaf

func (n *Node[T]) IsLeaf() bool

func (*Node[T]) IsLeft

func (n *Node[T]) IsLeft() bool

func (*Node[T]) IsLeftRelation

func (n *Node[T]) IsLeftRelation(node *Node[T]) bool

func (*Node[T]) IsRight

func (n *Node[T]) IsRight() bool

func (*Node[T]) IsRightRelation

func (n *Node[T]) IsRightRelation(node *Node[T]) bool

func (*Node[T]) IsRoot

func (n *Node[T]) IsRoot() bool

func (*Node[T]) IsSiblingRelation

func (n *Node[T]) IsSiblingRelation(node *Node[T]) bool

func (*Node[T]) IsUncleRelation

func (n *Node[T]) IsUncleRelation(node *Node[T]) bool

func (*Node[T]) Layer

func (n *Node[T]) Layer() int

func (*Node[T]) MaxDepth

func (n *Node[T]) MaxDepth() int

func (*Node[T]) SetLeft

func (n *Node[T]) SetLeft(left *Node[T]) (old *Node[T])

func (*Node[T]) SetRight

func (n *Node[T]) SetRight(right *Node[T]) (old *Node[T])

func (*Node[T]) Sibling

func (n *Node[T]) Sibling() *Node[T]

func (*Node[T]) TraversalBFS

func (n *Node[T]) TraversalBFS() (res []*Node[T])

func (*Node[T]) TraversalDFS

func (n *Node[T]) TraversalDFS() (res []*Node[T])

func (*Node[T]) Uncle

func (n *Node[T]) Uncle() *Node[T]

Jump to

Keyboard shortcuts

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