BinaryTree

Kind of class:class
Inherits from:none
Classpath:org.springsoft.aslib.BinaryTree
File last modified:Saturday, 22 January 2005, 14:27:02

Summary


Constructor
Instance properties
Instance methods

Constructor

BinaryTree

function BinaryTree (
)

BinaryTree Constructor

Instance properties

treeRoot_

private treeRoot_:TreeNode
(read)

Instance methods

insert

function insert (
data:BinaryTreeObject) : Void

Recursive insert
Parameters:
data:
The data to insert into the tree

insertHelper

private function insertHelper (
node:TreeNode, tree:TreeNode) : Void

Helper recursive insert
Parameters:
node:
The data to insert into the tree
tree:
Any tree node starting at the root

insertIter

function insertIter (
data:BinaryTreeObject) : Void

Iterative insert
Parameters:
data:
The data to insert into the tree

isEmpty

private function isEmpty (
Void) : Boolean

Test if tree is empty
Returns:
  • true if tree is empty. Otherwise returns false.

printInOrder

function printInOrder (
Void) : Void

Print tree InOrder
Parameters:
tree:
Any tree node starting at the root

printInOrderHelper

private function printInOrderHelper (
tree:TreeNode) : Void

Helper Print tree InOrder
Parameters:
tree:
Any tree node starting at the root

printPostOrder

function printPostOrder (
Void) : Void

Print tree PostOrder
Parameters:
tree:
Any tree node starting at the root

printPostOrderHelper

private function printPostOrderHelper (
tree:TreeNode) : Void

Helper Print tree PostOrder
Parameters:
tree:
Any tree node starting at the root

printPreOrder

function printPreOrder (
Void) : Void

Print tree PreOrder
Parameters:
tree:
Any tree node starting at the root

printPreOrderHelper

private function printPreOrderHelper (
tree:TreeNode) : Void

Helper Print tree PreOrder
Parameters:
tree:
Any tree node starting at the root

remove

function remove (
key:Number) : Void

Remove node
Parameters:
key:
The key to search for and to remove it from the tree

removeHelper

private function removeHelper (
key:Number, tree:TreeNode) : TreeNode

Helper remove node
Parameters:
key :
The key to search for and to remove in the tree
tree:
Any tree node starting at the root

searchHelper

private function searchHelper (
tree:TreeNode, key:Number) : BinaryTreeObject

Helper search binary tree
Parameters:
tree:
Any tree node starting at the root
key :
The key to search for in the tree
Returns:
  • BinaryTreeObject if key was found. Otherwise returns null.