BinaryTree

This class represents a binary tree

package

Application

Methods

Constructor, creates a new instance of BinaryTree class.

__construct() : mixed

Response

mixed

This method returns the left child node (binary tree) of the current node.

getLeft() : \com\scriptel\BinaryTree

Response

\com\scriptel\BinaryTree

This method returns the right child node (binary tree) of the current node.

getRight() : \com\scriptel\BinrayTree

Response

\com\scriptel\BinrayTree

This method returns the value of a leaf.

getValue() : int

Response

int

This method sets the left child node (binary tree) of the current node.

setLeft(\com\scriptel\BinaryTreeleft) : mixed

Arguments

left

\com\scriptel\BinaryTree

Response

mixed

This method sets the right child node (binary tree) of the current node.

setRight(\com\scriptel\BinaryTreeright) : mixed

Arguments

right

\com\scriptel\BinaryTree

Response

mixed

This method sets a value of this leaf.

setValue(intvalue) : mixed

Arguments

value

int

Response

mixed

Properties

If this node is a leaf, this contains the value of the leaf.

value : int
var

Type(s)

int

If this node is a branch this contains the left node.

left : \com\scriptel\BinaryTree
var

Type(s)

BinaryTree

If this node is a branch this contains the right node.

right : \com\scriptel\BinaryTree
var

Type(s)

BinaryTree