/* ITI 1121/1521. Introduction to Computer Science II * Assignment/Devoir 3 * * */ public class A5Q7 { public static void main( String[] args ) { StudentInfo.display(); BinarySearchTree t; t = new BinarySearchTree(); String[] xs = { "F", "B", "H", "G", "A", "D", "C", "E" }; for ( int i=0; i < xs.length; i++ ) { t.add( xs[ i ] ); System.out.println( t ); System.out.println( "t.getLeavesCount() -> " + t.getLeavesCount() ); System.out.println(); } System.out.println(); } } // > java A5Q7 // // ************************************************************ // * * // * * // * * // * * // ************************************************************ // // (()F()) // t.getLeavesCount() -> 1 // // ((()B())F()) // t.getLeavesCount() -> 1 // // ((()B())F(()H())) // t.getLeavesCount() -> 2 // // ((()B())F((()G())H())) // t.getLeavesCount() -> 2 // // (((()A())B())F((()G())H())) // t.getLeavesCount() -> 2 // // (((()A())B(()D()))F((()G())H())) // t.getLeavesCount() -> 3 // // (((()A())B((()C())D()))F((()G())H())) // t.getLeavesCount() -> 3 // // (((()A())B((()C())D(()E())))F((()G())H())) // t.getLeavesCount() -> 4