import java.util.Scanner; /** * A simple program for testing BinarySearchTree. * * @author William Killian, Chad Hogg */ public class BSTProgram { /** * Runs the program. * * @param args */ public...

Binary Search


import java.util.Scanner; /** * A simple program for testing BinarySearchTree. * * @author William Killian, Chad Hogg */ public class BSTProgram { /** * Runs the program. * * @param args */ public static void main(String[] args) { Scanner console = new Scanner(System.in); BinarySearchTree tree = new BinarySearchTree(); System.out.print("Line of characters to insert: "); String data = console.next(); for (char c : data.toCharArray()) { tree.add(c); } System.out.println("After inserting: " + tree.toString()); System.out.println(); System.out.println(tree); System.out.print("Line of characters to remove: "); data = console.next(); for (char c : data.toCharArray()) { tree.remove(c); } System.out.println("After removing: " + tree.toString()); System.out.println(); System.out.println(tree); console.close(); } }
Dec 03, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here