Main Method

mail@pastecode.io avatar
unknown
java
a year ago
935 B
0
Indexable
Never
package LAB4;
import java.util.*;

public class Main
{
    public static void main(String[] args)
    {
        /*// Initialize an array of integer values to be used for constructing 
        the binary search tree */
        int[] values = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};

        // Create a new BinarySearchTree object using the array of values
        BinarySearchTree myBST = new BinarySearchTree(values);

        // Print the Pre-order traversal result of the binary search tree
        System.out.println("Preorder:");
        System.out.println(myBST.DFSPreOrder());

        // Print the In-order traversal result of the binary search tree
        System.out.println("Inorder:");
        System.out.println(myBST.DFSInOrder());

        // Print the Post-order traversal result of the binary search tree
        System.out.println("Postorder:");
        System.out.println(myBST.DFSPostOrder());
    }
}