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




Author:
Lakshmi Krishnamurthy
  • Constructor Details

    • BinaryTreeNode

      public BinaryTreeNode​(PriorityQueueEntry<KEY,​ITEM> entry) throws java.lang.Exception
      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

      public BinaryTreeNode<KEY,​ITEM> parent()
      Retrieve the Parent
      Returns:
      The Parent
    • left

      public BinaryTreeNode<KEY,​ITEM> left()
      Retrieve the Left Child
      Returns:
      The Left Child
    • right

      public BinaryTreeNode<KEY,​ITEM> right()
      Retrieve the Right Child
      Returns:
      The Right Child
    • entry

      public PriorityQueueEntry<KEY,​ITEM> 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

      public boolean setKey​(KEY key)
      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

      public boolean setParent​(BinaryTreeNode<KEY,​ITEM> parent)
      Set the Parent of the Node
      Parameters:
      parent - The Parent
      Returns:
      TRUE - The Node's Parent successfully set
    • setLeft

      public boolean setLeft​(BinaryTreeNode<KEY,​ITEM> left)
      Set the Left Child of the Node
      Parameters:
      left - The Left Child
      Returns:
      TRUE - The Node's Left Child successfully set
    • setRight

      public boolean setRight​(BinaryTreeNode<KEY,​ITEM> right)
      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

      public BinaryTreeNode<KEY,​ITEM> smallerChild()
      Retrieve the Child Node with the Smaller Value
      Returns:
      The Child Node with the Smaller Value
    • largerChild

      public BinaryTreeNode<KEY,​ITEM> 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 class java.lang.Object