I'm completely new to BST and how they work if this is completely wrong it would be appreciated if I could get a link to a reference site or something. right now I'm writing a program to add values from an ArrayList of Strings to a BST and I come up with errors such as The method compareTo(Node) is undefined for the type ArrayList<String>. I thought by having extends Comparable it would account for comparing ArrayList values but I'm not using E. Also I had to add a cast to s to set it as the root but I feel like there is an easier way. I don't know if I can add ArrayList values the way I'm doing it, this is just how it looks in the book I'm using for reference. This is my code, any help would be appreciated, I already tried looking up things in the Java API and that didn't help:
public class BinarySearchTree<E extends Comparable<? super E>>
{
public void add(ArrayList<String> s, Node n) {
if (n == null)
n = (Node) s;
else if (s.compareTo(n) < 0)
add(s, n.leftChild);
else
add(s, n.rightChild);
}
}