import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

/**
 * Driver that tests the search times on various Nary trees.
 *   @author davereed
 *   @version 2/18/17
 */
public class TreeDriver {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.print("Enter the tree size: ");
        int treeSize = input.nextInt();

        ArrayList<Integer> nums = new ArrayList<Integer>();
        for (int j = 0; j < treeSize; j++) {
            nums.add(j);
        }
        Collections.shuffle(nums);

        StopWatch timer = new StopWatch();

        BinarySearchTree<Integer> tree = new BinarySearchTree<Integer>();
        for (Integer nextNum : nums) {
            tree.add(nextNum);
        }

        timer.start();
        for (Integer nextNum : nums) {
            tree.contains(nextNum);
        }
        timer.stop();

        System.out.println("tree of size " + treeSize + ": " + 
                            timer.getElapsedTime() + " msec");
    }
}
