• Home
  • University of the People
  • Data Structures (proctored course) CS 3303
  • Data Structures (proctored course) CS 3303

Data Structures (proctored course) CS 3303

8/7/22, 1:33 AM CS 3303-01 - AY2022-T5: Discussion Forum-Unit 5 CS 3303-01 Data Structures - AY2022-T5 Dashboard / My courses / CS 3303-01 - AY2022-T5 / 14 July - 20 July / _Discussion Forum Unit 5 /_Discussion Forum-Unit 5 Search forums Discussion Forum Unit 5 Discussion Forum-Unit 5 # Settings Display replies in nested form The cut-off date for posting to this forum is reached so you can no longer post to it. Discussion Forum-Unit 5 by Rupali Memane (Instructor) - Tuesday, 14 June 2022, 10:33 AM Discussion Assignment Unit 5 General Tree Algorithm Review Discussion Question Using Jeliot, 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.printIn("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.printIn("Traversing tree "); printOrder(root); } https://my.uopeople.edu/mod/forum/discuss.php?d=808761 1/51 8/7/22, 1:33 AM CS 3303-01 - AY2022-T5: Discussion Forum-Unit 5 public static void insert(Node node,int value){ if (value < node.value) { if (node.left != null) { insert(node.left, value); } else{ System.out.printIn(" 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.printIn(" 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.printIn(" 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 determine whose analysis is most accurate. You must post your initial response before being able to review other student9s responses. Once you have made your first response, you will be able to reply to other student9s posts. You are expected to make a minimum of 3 responses to your fellow student9s posts. 351 words Permalink Re: Discussion Forum-Unit 5 by Illia Ragozin - Thursday, 14 July 2022, 7:51 PM Input and execution. The code is building a tree and traversing it. If we insert the code into the Jeliot tool, the resulting tree would be the output below: https://my.uopeople.edu/mod/forum/discuss.php?d=808761 2/51 8/7/22, 1:33 AM CS 3303-01 - AY2022-T5: Discussion Forum-Unit 5 For a better understanding we can redraw it as a tree with proper levels: The output of the operation is summarized below: Tree Example Building tree with root value 5 Inserted 1 to left of 5 Inserted 8 to right of 5 Inserted 6 to left of 8 Inse