Data Structures In C By Padma Reddy Ebook Free 13 ((INSTALL))
CLICK HERE === https://blltly.com/2t9IbC
public class BinaryTree {
private int max;
private int[] parent;
public BinaryTree(int max) {
this.max = max;
this.parent = new int[max];
}
public void insert(int data) {
if(!isEmpty()) {
int left = leftChild(data);
int right = rightChild(data);
if(left!= right) {
int middle = left + (right - left) / 2;
if(data > middle)
left = insert(data);
else
right = insert(data);
}
else {
left = insert(data);
}
parent[data] = left;
}
else {
parent[data] = -1;
}
}
public void insert(int data, int i) {
insert(data);
parent[i] = data;
}
public int leftChild(int data) {
if(parent[data]!= -1)
return parent[data] = leftChild(parent[data]);
return -1;
}
public int rightChild(int data) {
if(parent[data]!= -1)
return parent[data] = rightChild(parent[data]);
return -1;
}
public boolean isEmpty() {
return parent[data] == -1;
}
public int size() {
int n = 0;
for(int i = 0; i < parent.length; i++) {
n += 1;
}
return n;
}
}
BinaryTreeHelper class 827ec27edc