示例#1
0
 /// <summary> Internal method to get element field.</summary>
 /// <param name="t">the node.
 /// </param>
 /// <returns> the element field or null if t is null.
 /// </returns>
 private Comparable elementAt(BinaryNode t)
 {
     return(t == null?null:t.element);
 }
示例#2
0
 /// <summary> Double rotate binary tree node: first right child
 /// with its left child; then node k1 with new right child.
 /// For AVL trees, this is a double rotation for case 3.
 /// </summary>
 internal static BinaryNode doubleWithRightChild(BinaryNode k1)
 {
     k1.right = withLeftChild(k1.right);
     return(withRightChild(k1));
 }
示例#3
0
 internal BinaryNode(Comparable theElement, BinaryNode lt, BinaryNode rt)
 {
     element = theElement;
     left    = lt;
     right   = rt;
 }
示例#4
0
 /// <summary> Double rotate binary tree node: first left child
 /// with its right child; then node k3 with new left child.
 /// For AVL trees, this is a double rotation for case 2.
 /// </summary>
 internal static BinaryNode doubleWithLeftChild(BinaryNode k3)
 {
     k3.left = withRightChild(k3.left);
     return(withLeftChild(k3));
 }