Question

Given the following binary tree (where nullptr height == -1):

0100 0050 0150 0125) 0152 0003 0080 000100200052 00830009

A. What is the height of the tree?

B. What is the depth of node 90?

C. What is the height of node 90?

D. Give the pre-order, in-order, and post-order traversal of this tree.

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

Answer:

D) Inorder : 0001 , 0003 , 0020, 0050 , 0052 , 0080 , 0083, 0090 , 0099 , 0100 , 0125 , 0150 , 152

Post Order : 0001 , 0020 , 0003 , 0052 , 0083 , 0099, 0090 , 0080, 0050 , 0125, 152 , 150 , 0100

Trick for finding preorder , postorder and inorder of a tree : For Pre - order - Traverse the tree from top to bootom and left to right, when you visit the node first time print it.

For Inorder - Whenever you vist the node second time , print it.

For Post Order : When you visit the node 3rd times print it.

22119253_1906999749620265_1501542027_n.j

Add a comment
Know the answer?
Add Answer to:
Given the following binary tree (where nullptr height == -1): A. What is the height of...
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
  • Data structures Exercises: For the following binary tree (Index-Value): 0 1 2 3 4 5 6...

    Data structures Exercises: For the following binary tree (Index-Value): 0 1 2 3 4 5 6 7 8 9 A C E G B P D X F H Give the pre-order traversal. Give the post-order traversal. Give the in-order traversal. Determine the height of the tree. Using these values: 8 6 4 3 5 9 2 1 6 Build a binary search tree. Build an AVL Tree. Build a 2-3 Tree. Build a min-heap. Build a max-heap. Apply a...

  • (b) Given the following tree (graph) as shown in Figure 2: Diberi pepohon (graf) seperti yang...

    (b) Given the following tree (graph) as shown in Figure 2: Diberi pepohon (graf) seperti yang ditunjukkan dalam Rajah 2: Figure 2 Rajah 2 (i) Find the pre-order traversal of the tree. Cari penyusuran pepohon "pre-order". (8/100) (ii) Find the post-order traversal of the tree. Cari penyusuran pepohon "port-order". (8/100) (iii Using the ordering c, d, e, f, g, h, i, j, k, I, m, a, b, c and the depth-first search algorithm, find a spanning tree for the graph...

  • Consider the AVL Tree built by inserting the following sequence of integers, one at a time:...

    Consider the AVL Tree built by inserting the following sequence of integers, one at a time: 5, 2, 8, 7,9 Then we insert 11. After we insert 11, before we perform any necessary rotations, is the tree balanced? And if not, which is the root of the lowest imbalanced subtree? (a) None, since the tree is already balanced after inserting 11. (b) The node containing 5. (c) The node containing 8. (d) The node containing 11. (e) The node containing...

  • A Binary Search Tree is a binary tree where nodes are ordered in the following way:...

    A Binary Search Tree is a binary tree where nodes are ordered in the following way: each node contains one key (also known as data) the keys in the left subtree are less than the key in its parent node the keys in the right subtree are greater than the key in its parent node duplicate keys are not allowed Create a Binary Search Tree inserting the following list of numbers in order from left to right. 10,          6,           4,            8,            18,          15,          21 Please type...

  • Question 39 Binary Trees: Traversal Describe the binary tree shown using depth-first, in order traversal (image...

    Question 39 Binary Trees: Traversal Describe the binary tree shown using depth-first, in order traversal (image t) void print TreeNode * start = nullptr){ // by default, we'll print from the head if (start == nullptr) // if nullptr, then we should start from the head start = head; if ( start->left != nullptr) printTree( start->left ) cout<< start-value << ", "; // print the current node if ( start->right != nullptr) printTree( start->right) } 12 15 10 14 18...

  • Insert the following values in the given order into a Binary Search Tree and use the...

    Insert the following values in the given order into a Binary Search Tree and use the resulting BST in the next 5 questions. 15 8 3 6 23 9 11 10 20 13 5 9. What is the height of the resulting Binary Search Tree? 10. What is the depth of the node that stores the value 11? 11. Is there a path from the node storing the value 15 to the node storing the value 5? If so, show...

  • 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...

  • Assume you are given “preorder” and “inorder” traversal result of a Binary Tree. Write an algorithm...

    Assume you are given “preorder” and “inorder” traversal result of a Binary Tree. Write an algorithm (pseudocode) that constructs the Binary Tree. For example, you can start with the Pre-Order and In-Order traversal of the same tree given below. Pre-Order = 80, 50, 10, 70, 100 In-Order = 10, 50, 70, 80, 100

  • Apply Preorder and Inorder traversal algorithms on the following binary tree and write the output. Remove...

    Apply Preorder and Inorder traversal algorithms on the following binary tree and write the output. Remove node 11 from the tree and show the tree after deletion. 0007 0005 0011 0003 0006 0010 0012 0009 0024 0023

  • Beginning with an empty binary search tree, what binary search tree is formed when you add the following letters in the order given?

    Trees-related questionsBeginning with an empty binary search tree, what binary search tree is formed when you add the following letters in the order given? J, N, B, A, W, E, TRepresent the following binary tree with an array  What is the result of adding 3 and 4 to the 2-3 tree shown below?Why does a node in a red-black tree require less memory than a node in a 2-3-4 tree?Why can’t a Red-Black Tree have a black child node with exactly...

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