public abstract static class BinaryTree.Node extends Object
Constructor and Description |
---|
Node()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected int |
depth()
Computes recursively the depth of the sub-tree whose root is this node.
|
BinaryTree.Node |
getLeftChild()
Returns the left child of this node.
|
BinaryTree.Node |
getParent()
Returns the parent node (if any) of this node.
|
BinaryTree.Node |
getRightChild()
Returns the right child of this node.
|
boolean |
isLeaf()
Determines whether the node is a leaf in the tree.
|
protected int |
numNodes()
Computes recursively the number of nodes under the current node, including itself.
|
void |
setLeftChild(BinaryTree.Node leftChild)
Sets a node as left child of this node.
|
void |
setRightChild(BinaryTree.Node rightChild)
Sets a node as right child of this node.
|
public BinaryTree.Node getParent()
public BinaryTree.Node getLeftChild()
public void setLeftChild(BinaryTree.Node leftChild)
leftChild
- left childpublic BinaryTree.Node getRightChild()
public void setRightChild(BinaryTree.Node rightChild)
rightChild
- right nodepublic boolean isLeaf()
protected int numNodes()
protected int depth()
Copyright © 2016. All rights reserved.