LinkedBinaryTree

A tree in which element can have either zero, one or two children. This structure is link-based.

length

/**
 * Number of elements in the tree.
 *
 * @readonly
 */
get length(): number

addLeft()

/**
 * Adds element as the left child of the specified position. Throws an error if left child already exists.
 *
 * @param position Position in the tree.
 * @param element Element to add.
 * @returns Position of the added element.
 */
addLeft(position: P, element: T): P

addRIght()

/**
 * Adds element as the right child of the specified position. Throws an error if right child already exists.
 *
 * @param position Position in the tree.
 * @param element Element to add.
 * @returns Position of the added element.
 */
addRight(position: P, element: T): P

addRoot()

areEqual()

attachLeft()

attachRight()

clear()

getChildren()

getLeft()

getNumChildren()

getDepth()

getHeight()

getParent()

getRight()

getRoot()

getSibling()

hasLeft()

hasRight()

hasSibling()

isEmpty()

isLeaf()

isLeftChild()

isRightChild()

isRoot()

remove()

replace()

traverse()

Last updated

Was this helpful?