Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.

QUESTION

Hey! check the attachments please and let me if you need more information , thanks

Hey! check the attachments please and let me if you need more information , thanks

  • Attachment 1
  • Attachment 2
1. Draw the binary search tree that results from adding the following elements in thespecified order. Assume the tree is initially empty.8, 5, 6, 2, 7, 10, 9, 122. In your BST from #1, indicate the order in which the nodes are visited for a(n):a. (1 pt) In-order traversalb. (2 pts) Post-order traversalc. (2 pts) Pre-order traversal3. Draw what your BST from #1 looks like after each of the following deletions (assume they areperformed sequentially):a. (1 pt) Delete the 12b. (1 pt) Delete the 6c. (2 pts) Delete the 84. For these coding problems, use the BinarySearchTree class that we wrote in lecture as a startingpoint.a. Write a non-recursive addIterative(E newItem) method. In other words, do not call thismethod within its own definition! (Hint: create a temp reference to the root node andmove it down the tree as you search for the correct add position.)b. In class we discussed pre-order, in-order, and post-order traversals. Another common type oftree traversal is a level-order traversal. This involves visiting the nodes of the tree left-to-right,top-to-bottom (just like the way you normally read a page of text). See the next page for anexample 50 74 9 1 For example, in the BST above a level-order traversal would visit the nodes in this order: 5 0 7 4 9 1Write a levelOrderTraverse method. The method should print the nodes in the order that they arevisited. (Hint: one non-recursive algorithm for this is to use a queue to keep track of the nodes that youwant to visit. Start by enqueuing the root node, and see what needs to be done from there.)
Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question