execute the following tree algorithm: import Prog1Tools.IOTools; class Node { Node left; Node right; int value; public Node(int value) { this.value = value; } } public class GeneralTreeTest { public static void main(String[] args) { // build a simple tree add 5 nodes to the tree Node root = new Node(5); System.out.println("Tree Example"); System.out.println("Building tree with root value " + root.value); insert(root, 1); insert(root, 8); insert(root, 6); insert(root, 3); insert(root, 9); System.out.println("Traversing tree "); printOrder(root); } public static void insert(Node node, int value) { if (value < node.value) { if (node.left != null) { insert(node.left, value); } else { System.out.println(" Inserted " + value + " to left of " + node.value); node.left = new Node(value); } } else if (value > node.value) { if (node.right != null) { insert(node.right, value); } else { System.out.println(" Inserted " + value + " to right of " + node.value); node.right = new Node(value); }
} } public static void printOrder(Node node) { if (node != null) { printOrder(node.left); System.out.println(" Traversed " + node.value); printOrder(node.right); } } } This algorithm first inserts five nodes into a tree structure and then traverses the tree. Using the Jeliot environment, load, compile and execute this java algorithm to understand its operation. Determine the kind of tree structure that is being created and determine what kind of traversal the algorithm is conducting. Finally, conduct an Asymptotic analysis for the provided algorithm and report your analysis including Big O, Big Omega, or Big Theta as appropriate. The provided Java algorithm is creating a binary search tree, which is a special kind of tree where each node has at most two children, and the value of the left child is less than the value of the parent node, while the value of the right child is greater than the parent node. D Jeliot 3.7.2" Eile Edit Control Animation Options Help × 1 import jeliot.10. 5; 2 3 import ProgiTools. IOTools: 4 5 class Node { 6 Node left; 7 Node right; int value; 8 Theater Call Tree Method Area History Expression Evaluation Area 10 public Dode|int value) ( 11 this. value = value; 12 19 14 15 public class GeneralTreeTest { 16 public static void Main(String 17 18 /2 build a simple tree adi Node coot = new Node (5); System. out. println("Tree Es 19 20 21 Systex. out. println("Buildit 22 insert |root, 1); 23 inzert |root, 8); 24 insert |root, 6): 25 insert|root, 3); 26 inzert |root, 9); 27 System. out. println("Traver printOrder (root) ; 28 29 30 31 37 public static void insert(Node ir |value < pode. value){ Constant Area Instance and Array Area CONSTANTS Edit Compile Step JELIOT Animation Speed 4 Play Pause 11 Traversed 6 Traversed B Traversed 9 Rewind Console W || EN 9:18 AM 5/10/2023
The algorithm is conducting an inorder traversal, which visits the left subtree first, then the parent node, and then the right subtree. This traversal produces the values in ascending order, which is a useful property of binary search