Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions src-java/BinaryTree Implementation
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
public class BinaryTree{
private TreeNode root;
private class TreeNode{
private TreeNode left;
private TreeNode right;
private TreeNode null;

public TreeNode(int data){
this.data=data;
}
}

public void createBT(){
TreeNode first=new TreeNode(1);
TreeNode second=new TreeNode(2);
TreeNode third=new TreeNode(3);
TreeNode fourth=new TreeNode(4);
TreeNode fifth=new TreeNode(5);

root=first;
first.left=second;
first.right=third;
second.left=fourth;
second.right=fifth;
}

public static void main(String args[]){
BinaryTree bt=new BinaryTree();
bt.createBT();
}
}
31 changes: 31 additions & 0 deletions src-java/BinaryTreeImplementation
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
public class BinaryTree{
private TreeNode root;
private class TreeNode{
private TreeNode left;
private TreeNode right;
private TreeNode null;

public TreeNode(int data){
this.data=data;
}
}

public void createBT(){
TreeNode first=new TreeNode(1);
TreeNode second=new TreeNode(2);
TreeNode third=new TreeNode(3);
TreeNode fourth=new TreeNode(4);
TreeNode fifth=new TreeNode(5);

root=first;
first.left=second;
first.right=third;
second.left=fourth;
second.right=fifth;
}

public static void main(String args[]){
BinaryTree bt=new BinaryTree();
bt.createBT();
}
}