So far I have written the Node class as
class Node { private value; private Node left; private Node right; public int getValue() { return value; } public void setValue(int value) { this.value = value; } public Node getLeft() { return left; } public void setLeft(Node left) { this.left = left; } public Node getRight() { return right; } public void setRight(Node right) { this.right = right; } }
and binary search tree as
public class BinarySearchTree { private Node root; public BinarySearchTree(int value) { root = new Node(value); } public void insert(int value) { Node node = new Node(value);
Now I would like to support BinarySearchTree to have a Node insert of any type, such as strings, people
How can I make it general for any type of storage?
source share