T
- public interface BinaryTreeKernel<T> extends Standard<BinaryTree<T>>
BinaryTree
kernel component containing method headers and contracts
for all methods that will directly interact with the data representations of
all BinaryTree implementations. All sub-interface methods should use only
these methods to perform operations on the BinaryTree
.Modifier and Type | Method and Description |
---|---|
void |
build(T root,
BinaryTree<T> left,
BinaryTree<T> right)
Builds
this into a Binary Tree with root as the root of
the tree, left as the left subtree of this , and right as the right subtree of this . |
int |
height()
Reports the height of
this . |
BinaryTree<T> |
leftSubtree()
Removes the left subtree from
this and returns it. |
BinaryTree<T> |
rightSubtree()
Removes the right subtree from
this and returns it. |
T |
root()
Returns a reference to the root of
this . |
int |
size()
Reports the number of nodes int
this . |
clear, newInstance, transferFrom
void build(T root, BinaryTree<T> left, BinaryTree<T> right)
this
into a Binary Tree with root
as the root of
the tree, left
as the left subtree of this
, and right
as the right subtree of this
.root
- the new root of this
left
- the new left subtree of this
right
- the new right subtree of this
[left is not null] and [right is not null] and [left != right] and [left != this] and [right != this]
root
at its root node,
left
as the left subtree of this
, and
right
as the right subtree of this
]BinaryTree<T> leftSubtree()
this
and returns it.BinaryTree<T> rightSubtree()
this
and returns it.T root()
this
.int size()
this
.int height()
this
.this
this
]