public static void main(String[] args){
BinaryTree a = new BinaryTree("7");
BinaryTree l = new BinaryTree("4");
BinaryTree lr = new BinaryTree("5");
BinaryTree r = new BinaryTree("9");
BinaryTree rr = new BinaryTree("2");
BinaryTree lrl = new BinaryTree("0");
lrl.attachLeft("3");
lrl.attachRight("8");
rr.attachLeft("6");
rr.attachRight("1");
r.attachRightTree(rr);
lr.attachLeftTree(lrl);
l.attachRightTree(lr);
a.attachLeftTree(l);
a.attachRightTree(r);
System.out.println(a.count());
System.out.println(a.height());
System.out.println(a.find("6"));
System.out.println(a.find("41"));
System.out.println(a.max());
a.preorder();
a.inorder();
a.postorder();
BinaryTree b = new BinaryTree(a);
System.out.println(b.count());
System.out.println(b.height());
System.out.println(b.find("6"));
System.out.println(b.find("41"));
System.out.println(a.max());
b.preorder();
b.inorder();
b.postorder();
BinaryTree c = new BinaryTree("");
c.readFile("Test.txt");
c.preorder();
c.inorder();
c.postorder();
}
}
Published by Chris Chen
Chris is currently attending the University of California, Berkeley seeking an undergraduate's degree in Electrical Engineering Computer Science. He enjoys playing basketball, practicing kendo, hanging out w... View profile
- Why I Love Open Source SoftwareWhy open source software like Drupal and WordPress make sense.
- The Ultimate Source of Spam and How to Avoid ItThe greatest source of all internet spam has been determined. Find out what it is, and defend yourself from email spam!
- Using Open Source in a Sensible WayA reflection on the use of Open Source Software in business.
- Indiana Michigan Source Providers: Heads Up!This is a thought that I have had for sometime for area source providers.
- Open Source File CompressionThis article is a brief overview how to get superior file compression using Open Source Software in the Microsoft Windows Environment.
- Easy Java - Linked List Implementation
- Types of Access Modifiers and Ways to Declare Methods in Java Programming for Begi...
- Your First Java Program
- A Guide to Start Programming in Java
- Going Beyond the Code: Doom Source Ports
- Day of Defeat: Source, Valve's Answer to the Call of Duty Juggernaut
- Open Source (R)Evolution



