Class: BinaryTreeNode

BinaryTreeNode

Binary tree node implementation.

new BinaryTreeNode(value)

Parameters:
Name Type Description
value Number | String The value of the node
Author:
  • Jakub Melezinek
Source:

Methods

getIndex() → {Number}

Source:
See:
  • static function btv.BinaryTree#getIndex
Returns:
Type
Number

getLeft() → {btv.BinaryTreeNode}

Source:
Returns:
Type
btv.BinaryTreeNode

getParent() → {btv.BinaryTreeNode}

Source:
Returns:
Type
btv.BinaryTreeNode

getRight() → {btv.BinaryTreeNode}

Source:
Returns:
Type
btv.BinaryTreeNode

getValue() → {Number}

Source:
Returns:
Type
Number

isLeaf() → {Boolean}

Source:
Returns:
Type
Boolean

isRoot() → {Boolean}

Source:
Returns:
Type
Boolean

setLeft(left)

Set left child and changes all needed references.
Parameters:
Name Type Description
left btv.BinaryTreeNode
Source:
Throws:
Throws an exception if this node is same as given node - try to set yourself as a child of yourself.

setRight(right)

Set right child and changes all needed references.
Parameters:
Name Type Description
right btv.BinaryTreeNode
Source:
Throws:
Throws an exception if this node is same as given node - try to set yourself as a child of yourself.

toString() → {String}

Source:
Returns:
Type
String