| Constructor and Description |
|---|
BinaryTree(Graph<V,E> graph)
Tried to construct the binary tree given a graph
|
| Modifier and Type | Method and Description |
|---|---|
java.util.List<BinaryTreeNode<V>> |
getNodes() |
BinaryTreeNode<V> |
getRoot() |
int |
height() |
boolean |
isBalanced()
Checks if the binary tree is balanced
A height-balanced binary tree is defined as a binary tree in
which the depth of the two subtrees of every node
never differ by more than 1.
|
boolean |
isCanBeConstructed() |
void |
setNodes(java.util.List<BinaryTreeNode<V>> nodes) |
void |
setRoot(BinaryTreeNode<V> root) |
java.lang.String |
toString() |
public boolean isBalanced()
true if tree is balanced, false otherwisepublic int height()
public BinaryTreeNode<V> getRoot()
public void setRoot(BinaryTreeNode<V> root)
root - The root to setpublic java.util.List<BinaryTreeNode<V>> getNodes()
public void setNodes(java.util.List<BinaryTreeNode<V>> nodes)
nodes - Nodes to setpublic java.lang.String toString()
toString in class java.lang.Objectpublic boolean isCanBeConstructed()