Tree class

Index

Constructors

Public Properties

Public Methods

Constructors


constructor

⊕ new Tree(value?: T | T[] | Tree<T>): Tree

Parameters:

  • value: T | T[] | Tree<T>, Default value = null

Public Properties


childs

● childs: Tree<T>[] = []


parent

● parent: Tree<T> = null


value

● value: T = null


Public Methods


addChild

▸ addChild(child: Tree<T>): void

Parameters:

Returns void


contains

▸ contains(value: T): boolean

Parameters:

  • value: T

Returns boolean


findNode

▸ findNode(value: T): Tree<T> | null

Parameters:

  • value: T

Returns Tree<T> | null


setParents

▸ setParents(): void

Returns void