Untitled
unknown
java
3 years ago
771 B
7
Indexable
package LAB8;
public class main
{
public static void main(String[] args)
{
// Create a new AVLTree
AVLTree tree = new AVLTree();
// Insert the specified elements into the tree
tree.rootNode = tree.insert(tree.rootNode, 10);
tree.rootNode = tree.insert(tree.rootNode, 20);
tree.rootNode = tree.insert(tree.rootNode, 30);
tree.rootNode = tree.insert(tree.rootNode, 40);
tree.rootNode = tree.insert(tree.rootNode, 50);
tree.rootNode = tree.insert(tree.rootNode, 25);
// Print the pre-order traversal of the constructed AVL tree
System.out.println("Preorder traversal of the constructed AVL tree is:");
tree.preOrderTraversal(tree.rootNode);
}
}
Editor is loading...