interface BinarySearchTree {
public void insert(Integer data);
public int size();
public int height();
public boolean contains(Integer target);
}

and I have to implement BST with all these functions. I have implemented the first insert and size like this way -

class Node {
Node left, right, next;
Integer data;
Node () {
left = right = null;
data = 0;
}
}

public class BSTree extends Node implements BinarySearchTree {
static Node root;
static int countNode;
/**
* Creates a new instance of BSTree
*/
public BSTree() {
root = null;
}
public void insert(Integer data) {
if (root == null) {
root.data = data;
countNode++;
} else {
Node temp = new Node();
temp = root;
while (temp != null) {
if (temp.data < data) temp = temp.right;
else {
temp = temp.left;
}
temp.data = data;
countNode++;
}
}
}
public int size () {
return countNode;
}

public int height() {}
public boolean contains (Integer target) {}

public static void main(String[] args) {

BSTree bs = new BSTree();
bs.insert(12);
bs.insert(3);
bs.insert(14);
}

}

Can any one help me by writing the code of finding the height and contains function ?

Comments
Stop this already. Very anoying and is only going to cause people to ignore you, not help you (although it's a hand-out, and not help, that you want).
Forum flooding, I strongly recommend you first reading the rules I had linked to before going on flooding spree

Please post your code in tags, its almost impossible to read without them.

Already had given her this advice in the first clone of this thread, but she just rather chose to just ignore it and created this one

Already had given her this advice in the first clone of this thread, but she just rather chose to just ignore it and created this one

Oh wow. I don't see very much mod activity on this forum...maybe some more mods, or just more intense actions.

This question has already been answered. Start a new discussion instead.