Question

Assignment 4 1)For all the questions in Assignment 4, you need to draw a diagram to describe the ...

Assignment 4

1)For all the questions in Assignment 4, you need to draw a diagram to describe the steps and provide short description as needed. Construct a Binary Search Tree by inserting the following node one by one. [4 points] 7,12,6,9,11,23,24,27,15

2)Provide an example for each following cases to search a given key in a Binary Search Tree. [4 points]

Time efficiency=Ο(1)3S8CEMtd9AAAAAElFTkSuQmCC

Time efficiency=ΟlogncdA3f5imtB2VefcxtquYZA8cQHOJLX+AydvU9UjZ

Time efficiency=Ο(n)ZRO+N+OcdxOBP4CbNI+pPm7zwkAAAAASUVORK5CY

3)For the BST you created in question 1, delete the node 9, then 7, then 24 [4 points] 8+(7*4+(3- 2))/6gFd6ZIUETwAAAABJRU5ErkJggg== [4 points]

4)Draw a Binary expression tree from the above infix expression. Write the postfix expression and prefix expression using Post-order Traversal and Pre-order Traversal. Using Stack to evaluate the postfix traversal

0 0
Add a comment Improve this question Transcribed image text
Answer #1

リUS 2

urot 3sT Saanth 3. rardom iboloncod BST, auch at : О a Scanch 3.

2 3 3dulibe delae. 7 (2 Is 27 dalste 14 23

9)8 (7 43 2)) 3 Stock S Node oot 4 (n.nigluts.peek()) t s.puoh (n) elre paint (n); S. push (n)

ni 2) ho n2(8) alt 01-) nI(+) nil4t)

iN 8+*74-32

Add a comment
Know the answer?
Add Answer to:
Assignment 4 1)For all the questions in Assignment 4, you need to draw a diagram to describe the ...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Assignment 4 1)For all the questions in Assignment 4, you need to draw a diagram to...

    Assignment 4 1)For all the questions in Assignment 4, you need to draw a diagram to describe the steps and provide short description as needed. Construct a Binary Search Tree by inserting the following node one by one. [4 points] 7,12,6,9,11,23,24,27,15 2)Provide an example for each following cases to search a given key in a Binary Search Tree. [4 points] Time efficiency=Ο(1)3S8CEMtd9AAAAAElFTkSuQmCC Time efficiency=ΟlogncdA3f5imtB2VefcxtquYZA8cQHOJLX+AydvU9UjZ Time efficiency=Ο(n)ZRO+N+OcdxOBP4CbNI+pPm7zwkAAAAASUVORK5CY 3)For the BST you created in question 1, delete the node 9, then 7,...

  • Name (print): Instruction: Answer all the questions. 1. Show the result of inserting 4,2, 5, 7,...

    Name (print): Instruction: Answer all the questions. 1. Show the result of inserting 4,2, 5, 7, 10, 3,6, 8 into an initially empty binary search step by step illustration when each number is inserted, starting from 4. [5 points) tree. Show a 2. Show the result of deleting the root. [2 points] Spring 2019 CS 291 Computer Science II 3. Give the prefix, infix, and postfix expressions corresponding to the tree below: 13 points] Prefix expression: Infix expression:

  • Overview The purpose of this assignment is to practice functional programming in the Racket Programming Language...

    Overview The purpose of this assignment is to practice functional programming in the Racket Programming Language and to also reinforce the notion of the list as a universal data structure, by implementing various operations on binary search trees. Specification A binary search tree is a binary tree which satisfies the following invariant property: for any node X, every node in X's left subtree has a value smaller than that of X, and every node in X's right subtree has a...

  • Write a Java program named BSTree.java that will: 1) Generate 20 random integer numbers ranging from...

    Write a Java program named BSTree.java that will: 1) Generate 20 random integer numbers ranging from 1-99. 2) Build a Binary Search Tree using this set of numbers. Write the add method. 3) After building the tree, display the data into three formats: prefix order, infix order, and postfix order. 4) Write a method to delete an element from the Binary Search Tree. First search the item in your TREE and then delete it.

  • Objective To acquire expertise in stack manipulation and management, subroutine linkage and retur...

    Objective To acquire expertise in stack manipulation and management, subroutine linkage and return conventions, and recursive procedures. Description You are to create a MIPS programming assignment that returns postfix representation of the input and create an expression tree. Your MIPS program should make use of the expression tree to store the input and provide, by means of an adequate traversal, the value for the expression. Your solution should be structured according to the following steps: Step 1: Convert expression from...

  • using java to write,show me the output. please write some common. You CAN NOT use inbuild...

    using java to write,show me the output. please write some common. You CAN NOT use inbuild functions for Tree ADT operations. using code below to finsih public class Main {    public static void main(String[] args) {        BinaryTree tree = new BinaryTree(); tree.root = new Node(1); tree.root.left = new Node(2); tree.root.right = new Node(3); tree.root.left.left = new Node(4); tree.root.left.right = new Node(5); tree.root.right.left = new Node(6); tree.root.right.right = new Node(7); tree.root.left.left.left = new Node(8); tree.root.left.left .right= new Node(9);...

  • 3. (8 points) Using the implementation of binary search tree operations we discussed in class, draw...

    3. (8 points) Using the implementation of binary search tree operations we discussed in class, draw the trees that result from the following operations: (a) Inserting 142, 400, 205, 127, 100, 320, 160, 141, and 110 into an initially-empty tree (in that order). (b) Deleting 142 from the tree you drew for part (a). 4. (8 points) Draw the unique binary tree that has a preorder traversal of 4, 1, 6, 3, 7, 5, 9, 2, 8 and an inorder...

  • in python 11.1 Binary Search Tree In this assignment, you will implement a Binary Search Tree...

    in python 11.1 Binary Search Tree In this assignment, you will implement a Binary Search Tree You will also need to implement a Node class. This class will not be tested, but is needed to implement the BST. Your BST must implement the following methods. You are free to implement additional helper methods. It is recommended you create your own helper methods Constructor: Creates an Empty Tree String Method: Returns the string "Empty Tree" for an empty tree. Otherwise, returns...

  • I need question 9-10 answered. Thank you Question 1 iShow the resulting binary search tree if...

    I need question 9-10 answered. Thank you Question 1 iShow the resulting binary search tree if we are to insert following elements into the tree in given order, [34, 12, 23, 27,31,9,11,45, 20, 37. i) Show the resulting balanced binary search tree if we are to insert following sorted elements into the tree, [9,12,21, 23, 29, 31, 34, 45, 48, 52, 55] iii What is the pre-order traversal of the balanced binary search tree? v) What is the post-order traversal...

  • You are to write a program name expressionTree.java that evaluates an infix expression entered by the...

    You are to write a program name expressionTree.java that evaluates an infix expression entered by the user. The expression may contain the following tokens: (1) Integer constants (a series of decimal digits). (2)   One alphabetic character - "x" (representing a value to be supplied later). (3)   Binary operators (+, -, *, / and % (modulo)). (4)   Parentheses          You will parse the input expression creating an expression tree with the tokens, then use the postOrder tree traversal algorithm to extract...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT