BinaryTree

BinaryTree

Class representing a binary tree

Constructor

new BinaryTree(value)

Source:
Parameters:
Name Type Description
value number value to assign in constructor

Methods

contains(value) → {boolean}

Source:
Parameters:
Name Type Description
value number key to search
Returns:
Type:
boolean
it contain the key or not

traverse(tree)

- Explores all the nodes in out tree - Print Each Value
Default Value:
  • tree = this
Source:
Parameters:
Name Type Description
tree BinaryTree
Example
var tree = new BinaryTree(12)
tree.traverse()