// Binary search tree of Strings import java.util.*; class BST { private class Node { public String data; public Node left; public Node right; public Node parent; Node( String data, Node parent ) { this.data = data; this.left = null; this.right = null; this.parent = parent; } } Node root; BST() { root = null; } // ---- INSERT A STRING ---- public void insert( String str ) { if (root == null) root = new Node( str, null ); else insert( str, root ); } private void insert( String str, Node n ) { if (str.compareTo( n.data ) < 0) if (n.left == null) n.left = new Node( str, n ); else insert( str, n.left ); else if (n.right == null) n.right = new Node( str, n ); else insert( str, n.right ); } // ---- TESTING CODE ---- public static void main( String [] args ) { BST bst = new BST(); for (int i=0; i