Package org.drip.graph.heap
Class BinaryTreeNode<KEY extends java.lang.Comparable<KEY>,ITEM>
java.lang.Object
org.drip.graph.heap.BinaryTreeNode<KEY,ITEM>
public class BinaryTreeNode<KEY extends java.lang.Comparable<KEY>,ITEM>
extends java.lang.Object
BinaryTreeNode implements a Node in a Binary Tree. The References are:
- Brodal, G. S., G. Lagogiannis, and R. E. Tarjan (2012): Strict Fibonacci Heaps Proceedings on the 44th Symposium on the Theory of Computing - STOC '12 1177-1184
- Cormen, T., C. E. Leiserson, R. Rivest, and C. Stein (2009): Introduction to Algorithms 3rd Edition MIT Press
- Hayward, R., and C. McDiarmid (1991): Average Case Analysis of Heap-building by Repeated Insertion Journal of Algorithms 12 (1) 126-153
- Suchanek, M. A. (2012): Elementary yet Precise Worst-case Analysis of Floyd's Heap Construction Program Fundamenta Informaticae 120 (1) 75-92
- Wikipedia (2020): Binary Heap https://en.wikipedia.org/wiki/Binary_heap
- Module = Computational Core Module
- Library = Graph Algorithm Library
- Project = Graph Optimization and Tree Construction Algorithms
- Package = Heap Based Priority Queue Implementations
- Author:
- Lakshmi Krishnamurthy
-
Constructor Summary
Constructors Constructor Description BinaryTreeNode(PriorityQueueEntry<KEY,ITEM> entry)
BinaryTreeNode Constructor -
Method Summary
Modifier and Type Method Description PriorityQueueEntry<KEY,ITEM>
entry()
Retrieve the Entryboolean
isLeaf()
Indicate if the Node is Leafboolean
isRightChild()
Indicate if the Node is a Right Child of the ParentBinaryTreeNode<KEY,ITEM>
largerChild()
Retrieve the Child Node with the Larger KeyBinaryTreeNode<KEY,ITEM>
left()
Retrieve the Left Childint
level()
Retrieve the LevelBinaryTreeNode<KEY,ITEM>
parent()
Retrieve the ParentBinaryTreeNode<KEY,ITEM>
right()
Retrieve the Right Childboolean
setAsRightChild(boolean isRightChild)
Set the Node as the Right Child of the Parentboolean
setKey(KEY key)
Set the Key of the Nodeboolean
setLeft(BinaryTreeNode<KEY,ITEM> left)
Set the Left Child of the Nodeboolean
setLevel(int level)
Set the Level of the Nodeboolean
setParent(BinaryTreeNode<KEY,ITEM> parent)
Set the Parent of the Nodeboolean
setRight(BinaryTreeNode<KEY,ITEM> right)
Set the Right Child of the NodeBinaryTreeNode<KEY,ITEM>
smallerChild()
Retrieve the Child Node with the Smaller Valuejava.lang.String
toString()
boolean
zeroOrOneChildren()
Indicate if the Node has 0 or 1 ChildrenMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Constructor Details
-
BinaryTreeNode
BinaryTreeNode Constructor- Parameters:
entry
- Entry- Throws:
java.lang.Exception
- Thrown if the Inputs are Invalid
-
-
Method Details
-
level
public int level()Retrieve the Level- Returns:
- The Level
-
parent
Retrieve the Parent- Returns:
- The Parent
-
left
Retrieve the Left Child- Returns:
- The Left Child
-
right
Retrieve the Right Child- Returns:
- The Right Child
-
entry
Retrieve the Entry- Returns:
- The Entry
-
isRightChild
public boolean isRightChild()Indicate if the Node is a Right Child of the Parent- Returns:
- TRUE - Node is a Right Child
-
setKey
Set the Key of the Node- Parameters:
key
- The Key- Returns:
- TRUE - The Node's Key successfully set
-
setLevel
public boolean setLevel(int level)Set the Level of the Node- Parameters:
level
- The Level- Returns:
- TRUE - The Node's Level successfully set
-
setParent
Set the Parent of the Node- Parameters:
parent
- The Parent- Returns:
- TRUE - The Node's Parent successfully set
-
setLeft
Set the Left Child of the Node- Parameters:
left
- The Left Child- Returns:
- TRUE - The Node's Left Child successfully set
-
setRight
Set the Right Child of the Node- Parameters:
right
- The Right Child- Returns:
- TRUE - The Node's Right Child successfully set
-
setAsRightChild
public boolean setAsRightChild(boolean isRightChild)Set the Node as the Right Child of the Parent- Parameters:
isRightChild
- TRUE - The Node is a Right Child- Returns:
- TRUE - The Node as the Right Child of the Parent is successfully set
-
zeroOrOneChildren
public boolean zeroOrOneChildren()Indicate if the Node has 0 or 1 Children- Returns:
- TRUE - The Node has 0 or 1 Children
-
isLeaf
public boolean isLeaf()Indicate if the Node is Leaf- Returns:
- TRUE - The Node is Leaf
-
smallerChild
Retrieve the Child Node with the Smaller Value- Returns:
- The Child Node with the Smaller Value
-
largerChild
Retrieve the Child Node with the Larger Key- Returns:
- The Child Node with the Larger Key
-
toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-