BinaryTree with superpowers! 馃挭
$ yarn add @clarketm/superbinarytree
$ npm install @clarketm/superbinarytree --save
Construct a BinaryTree
Get the root of the tree
Get the height of the tree
Get the height of the tree at node
Name | Type | Attribute | Description |
---|---|---|---|
node | BinaryTreeNode | root node |
Find minimum value in tree
Name | Type | Attribute | Description |
---|---|---|---|
node | BinaryTreeNode | root node |
Find maximum value in tree
Name | Type | Attribute | Description |
---|---|---|---|
node | BinaryTreeNode | root node |
Insert a value into the tree
Name | Type | Attribute | Description |
---|---|---|---|
value | Item | value to insert into the tree |
Search and retrieve a value from the tree
Name | Type | Attribute | Description |
---|---|---|---|
value | Item | value to search |
Remove a value from the tree
Name | Type | Attribute | Description |
---|---|---|---|
value | Item | value to remove |
Traverse the tree in preOrder traversal ordering
Name | Type | Attribute | Description |
---|---|---|---|
node | BinaryTreeNode | root node |
Traverse the tree in inOrder traversal ordering
Name | Type | Attribute | Description |
---|---|---|---|
node | BinaryTreeNode | root node |
Traverse the tree in postOrder traversal ordering
Name | Type | Attribute | Description |
---|---|---|---|
node | BinaryTreeNode | root node |
Traverse the tree in levelOrder traversal ordering
Name | Type | Attribute | Description |
---|---|---|---|
node | BinaryTreeNode | root node |
Convert the tree to an array
Name | Type | Attribute | Description |
---|---|---|---|
traversal | Traversal | method of traversal | |
flatten | boolean | if false return nodes; if true return only values |
TreeNode
Construct a TreeNode
Get the value of node
Get the right child node
Get the right child node