Examples of insertInOrder()


Examples of CtCILibrary.TreeNode.insertInOrder()

    System.out.println("Is balanced? " + isBalanced(root));
   
    // Could be balanced, actually, but it's very unlikely...
    TreeNode unbalanced = new TreeNode(10);
    for (int i = 0; i < 10; i++) {
      unbalanced.insertInOrder(AssortedMethods.randomIntInRange(0, 100));
    }
    System.out.println("Root? " + unbalanced.data);
    System.out.println("Is balanced? " + isBalanced(unbalanced));
  }
View Full Code Here

Examples of CtCILibrary.TreeNode.insertInOrder()

    TreeNode root = TreeNode.createMinimalBST(array);

   
    System.out.println("Is balanced? " + isBalanced(root));
   
    root.insertInOrder(4); // Add 4 to make it unbalanced

    System.out.println("Is balanced? " + isBalanced(root));
  }

}
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.