Modified Data Structures/Trees folder .java file name and class name
This commit is contained in:
parent
dcf7f8f657
commit
6dcce9f3e0
@ -1,4 +1,4 @@
|
|||||||
public class AVLtree {
|
public class AVLTree {
|
||||||
|
|
||||||
private Node root;
|
private Node root;
|
||||||
|
|
||||||
@ -200,7 +200,7 @@ public class AVLtree {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
AVLtree tree = new AVLtree();
|
AVLTree tree = new AVLTree();
|
||||||
|
|
||||||
System.out.println("Inserting values 1 to 10");
|
System.out.println("Inserting values 1 to 10");
|
||||||
for (int i = 1; i < 10; i++)
|
for (int i = 1; i < 10; i++)
|
||||||
|
@ -9,12 +9,12 @@ class Node
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class BinaryTree
|
public class LevelOrderTraversal
|
||||||
{
|
{
|
||||||
// Root of the Binary Tree
|
// Root of the Binary Tree
|
||||||
Node root;
|
Node root;
|
||||||
|
|
||||||
public BinaryTree()
|
public LevelOrderTraversal()
|
||||||
{
|
{
|
||||||
root = null;
|
root = null;
|
||||||
}
|
}
|
||||||
@ -65,7 +65,7 @@ class BinaryTree
|
|||||||
/* Driver program to test above functions */
|
/* Driver program to test above functions */
|
||||||
public static void main(String args[])
|
public static void main(String args[])
|
||||||
{
|
{
|
||||||
BinaryTree tree = new BinaryTree();
|
LevelOrderTraversal tree = new LevelOrderTraversal();
|
||||||
tree.root= new Node(1);
|
tree.root= new Node(1);
|
||||||
tree.root.left= new Node(2);
|
tree.root.left= new Node(2);
|
||||||
tree.root.right= new Node(3);
|
tree.root.right= new Node(3);
|
||||||
|
@ -14,7 +14,7 @@ class Node {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Class to print Level Order Traversal */
|
/* Class to print Level Order Traversal */
|
||||||
class BinaryTree {
|
public class LevelOrderTraversalQueue {
|
||||||
|
|
||||||
Node root;
|
Node root;
|
||||||
|
|
||||||
@ -49,7 +49,7 @@ class BinaryTree {
|
|||||||
{
|
{
|
||||||
/* creating a binary tree and entering
|
/* creating a binary tree and entering
|
||||||
the nodes */
|
the nodes */
|
||||||
BinaryTree tree_level = new BinaryTree();
|
LevelOrderTraversalQueue tree_level = new LevelOrderTraversalQueue();
|
||||||
tree_level.root = new Node(1);
|
tree_level.root = new Node(1);
|
||||||
tree_level.root.left = new Node(2);
|
tree_level.root.left = new Node(2);
|
||||||
tree_level.root.right = new Node(3);
|
tree_level.root.right = new Node(3);
|
||||||
|
@ -78,7 +78,7 @@ class Tree
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Driver class to test above methods
|
// Driver class to test above methods
|
||||||
public class Main
|
public class PrintTopViewofTree
|
||||||
{
|
{
|
||||||
public static void main(String[] args)
|
public static void main(String[] args)
|
||||||
{
|
{
|
||||||
|
@ -10,7 +10,7 @@ class Node
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class BinaryTree
|
public class ValidBSTOrNot
|
||||||
{
|
{
|
||||||
//Root of the Binary Tree
|
//Root of the Binary Tree
|
||||||
Node root;
|
Node root;
|
||||||
@ -47,7 +47,7 @@ public class BinaryTree
|
|||||||
/* Driver program to test above functions */
|
/* Driver program to test above functions */
|
||||||
public static void main(String args[])
|
public static void main(String args[])
|
||||||
{
|
{
|
||||||
BinaryTree tree = new BinaryTree();
|
ValidBSTOrNot tree = new ValidBSTOrNot();
|
||||||
tree.root = new Node(4);
|
tree.root = new Node(4);
|
||||||
tree.root.left = new Node(2);
|
tree.root.left = new Node(2);
|
||||||
tree.root.right = new Node(5);
|
tree.root.right = new Node(5);
|
||||||
|
Loading…
Reference in New Issue
Block a user