| 28 |
irasnyd |
1 |
// Written by Ira Snyder
|
|
|
2 |
// Due Date: 11-15-2004
|
|
|
3 |
// Project #3
|
|
|
4 |
|
|
|
5 |
import java.io.*;
|
|
|
6 |
import java.util.*;
|
|
|
7 |
class BinaryTree {
|
|
|
8 |
private Object root;
|
|
|
9 |
private BinaryTree left, right;
|
|
|
10 |
|
|
|
11 |
//constructors ----------------------------------------------------------
|
|
|
12 |
public BinaryTree( Object root ) { }
|
|
|
13 |
public BinaryTree( Object root, BinaryTree left, BinaryTree right ) { }
|
|
|
14 |
public BinaryTree( BinaryTree that ) { }
|
|
|
15 |
|
|
|
16 |
//getter methods --------------------------------------------------------
|
|
|
17 |
public Object getRoot() { }
|
|
|
18 |
public BinaryTree getLeft() { }
|
|
|
19 |
public BinaryTree getRight() { }
|
|
|
20 |
|
|
|
21 |
//setter methods --------------------------------------------------------
|
|
|
22 |
public Object setRoot( Object Root ) { }
|
|
|
23 |
public BinaryTree setLeft( BinaryTree left ) { }
|
|
|
24 |
public BinaryTree setRight( BinaryTree right ) { }
|
|
|
25 |
|
|
|
26 |
//toString method -------------------------------------------------------
|
|
|
27 |
public String toString() { }
|
|
|
28 |
|
|
|
29 |
//misc methods ----------------------------------------------------------
|
|
|
30 |
public boolean isLeaf() { }
|
|
|
31 |
public int size() { }
|
|
|
32 |
public int height() { }
|
|
|
33 |
public boolean contains( Object object ) { }
|
|
|
34 |
public int numLeaves() { }
|
|
|
35 |
public int count( Object x ) { }
|
|
|
36 |
public boolean isFull() { }
|
|
|
37 |
public boolean isBalanced() { }
|
|
|
38 |
public int pathLength() { }
|
|
|
39 |
public BinaryTree reverse() { }
|
|
|
40 |
public int level( Object x ) { }
|
|
|
41 |
public boolean isDisjointFrom( BinaryTree that ) { }
|
|
|
42 |
public boolean isValid() { }
|
|
|
43 |
public boolean equals( Object object ) { }
|
|
|
44 |
|
|
|
45 |
//printing methods ------------------------------------------------------
|
|
|
46 |
public static void preOrderPrint( BinaryTree tree ) { }
|
|
|
47 |
public static void postOrderPrint( BinaryTree tree ) { }
|
|
|
48 |
public static void levelOrderPrint( BinaryTree tree ) { }
|
|
|
49 |
public static void inOrderPrint( BinaryTree tree ) { }
|
|
|
50 |
}
|
|
|
51 |
|
|
|
52 |
/*
|
|
|
53 |
BufferedReader kb = new BufferedReader(
|
|
|
54 |
new InputStreamReader(System.in));
|
|
|
55 |
|
|
|
56 |
|
|
|
57 |
BufferedReader br = new BufferedReader(
|
|
|
58 |
new InputStreamReader(
|
|
|
59 |
new FileInputStream(filename)));
|
|
|
60 |
|
|
|
61 |
PrintStream ps = new PrintStream(
|
|
|
62 |
new FileOutputStream(
|
|
|
63 |
new File(filename)));
|
|
|
64 |
|
|
|
65 |
*/
|
|
|
66 |
|