tree

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2025 License: Apache-2.0 Imports: 1 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 struct {
	Value    string
	Children []*Node
}

represents a Node in a tree

func New

func New(value string) *Node

creates a new Node with the given value

func (*Node) Add

func (parent *Node) Add(value string) *Node

adds a new child node with the given value

func (*Node) AddPair

func (parent *Node) AddPair(key string, value string) *Node

adds a new child node with the formatted pair as the value

func (*Node) Print

func (root *Node) Print()

prints the tree represented by the root node

Jump to

Keyboard shortcuts

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