We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9fa9b2d commit 5d1e291Copy full SHA for 5d1e291
Trees/btree.java
@@ -0,0 +1,36 @@
1
+
2
+class Node
3
+{
4
+ int data;
5
+ Node left;
6
+ Node right;
7
+ Node(int data)
8
+ {
9
+ this.data=data;
10
+ left=right=null;
11
+ }
12
+}
13
14
+class BinaryTree{
15
+ Node root;
16
+ BinaryTree()
17
18
+ root = null;
19
20
+ BinaryTree(int data)
21
22
+ this.root=new Node(data);
23
24
25
26
+class btree{
27
+ public static void main(String[] args) {
28
29
+ BinaryTree bt=new BinaryTree(2);
30
+ bt.root.left=new Node(3);
31
+ bt.root.right=new Node(5);
32
+ bt.root.left.right=new Node(9);
33
+ bt.root.right.left=new Node(7);
34
35
36
0 commit comments