Question

8:08 33. Examine the following binary search tree and answer the question. The numbers on the circles labels so that we can t
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer:----------------

33. A Binary Search Tree (BST) is a tree in which all the nodes follow the below-mentioned properties −

  • The left sub-tree of a node has a key less than or equal to its parent node's key.
  • The right sub-tree of a node has a key greater than to its parent node's key.

a. If an item is to be inserted into the tree whose key data member is less than the key data member in node 1 but greater than the key data member in node 5 , then it would be inserted in the left of node 5.

b. if node 1 is to be deleted ,the value of node 3 could be used to replaced it, because it always greater than all key data member of deleted node .

c. 4,2,7,5,1,6,8,3 is in-order traversal of the tree that means LNR (Left-Node-Right).

d. 1,2,4,5,7,3,6,8 is pre-order traversal of the tree that means NLR (Node-Left-Right).

Add a comment
Know the answer?
Add Answer to:
8:08 33. Examine the following binary search tree and answer the question. The numbers on 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
  • 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...

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

  • Write a recursive function that returns the minimum key value in a binary search tree of...

    Write a recursive function that returns the minimum key value in a binary search tree of distinct (positive) integers. Return -1 in case the tree is empty. (b) Write a recursive function that returns the predecessor of the key value k in a binary search tree of distinct (positive) integers. This is the key value that precedes k in an inorder traversal of the tree. If k does not exist, or if k has no predecessor, your function should return...

  • QUESTION 1 In a tree, a ____ is a node with successor nodes. root child descendent...

    QUESTION 1 In a tree, a ____ is a node with successor nodes. root child descendent parent sibling QUESTION 2 In a tree, the ____ is a measure of the distance from a node to the root. count degree branch height level QUESTION 3 Which of the following is not a characteristic of a binary search tree? Each node has zero, one, or two successors. The preorder traversal processes the node first, then the left subtree, and then the right...

  • java A University would like to implement its students registery as a binary search tree, calledStudentBST....

    java A University would like to implement its students registery as a binary search tree, calledStudentBST. Write an Student node class, called StudentNode, to hold the following information about an Student: - id (as a int) - gpa (as double) StudentNode should have constructors and methods (getters, setters, and toString()) to manage Write the StudentBST class, which is a binary search tree to hold objects of the class StudentNode. The key in each node is the id. : import.java.ArrayList; public...

  • 2. Write a recursive algorithm which computes the number of nodes in a general tree. 3....

    2. Write a recursive algorithm which computes the number of nodes in a general tree. 3. Show a tree achieving the worst-case running time for algorithm depth. 4. Let T be a tree whose nodes store strings. Give an efficient algorithm that computes and prints, for every node v of T, the string stored at v and the height of the subtree rooted at v. Hin Consider 'decorating' the tree, and add a height field to each node (initialized to...

  • Can someone help with these two problems? The following binary tree contains the characters 'A' through...

    Can someone help with these two problems? The following binary tree contains the characters 'A' through 'G' in its nodes. List the nodes in the order that they are visited by: A preorder traversal. An inorder traversal. A postorder traversal. The binary tree in Problem 2 is a Binary Search Tree since for every node, all elements stored in the left subtree of the node are smaller than the element in the node and all elements stored in the right...

  • IN JAVA 2 A Binary Search Tree The goal of this lab is to gain familiarity...

    IN JAVA 2 A Binary Search Tree The goal of this lab is to gain familiarity with simple binary search trees. 1. Begin this lab by implementing a simple class that represents a "node” in a binary search tree, as follows. public class MyTreeNode<t extends Comparable<T>> { public T data; public MyTreeNode<T> leftchild; public MyTreeNode<T> rightChild; public MyTreeNode<T> parent; 2. Have the second member of your pair type in the code for the simple binary search tree interface. public interface...

  • 1. Write a recursive function that returns the sum of all even integers in a LinkedBinaryTree. Yo...

    please explain each line of code! ( in python ) 1. Write a recursive function that returns the sum of all even integers in a LinkedBinaryTree. Your function should take one parameter, root node. You may assume that the tree only contains integers. You may not call any methods from the LinkedBinaryTree class. Specifically, you should traverse the tree in your function def binary tree even sum (root): Returns the sum of al1 even integers in the binary tree 2....

  • Q8 - Construct a Binary Search Tree by inserting the following sequence of numbers. 5,6,3,2,10,4,1,7,9,8. Write...

    Q8 - Construct a Binary Search Tree by inserting the following sequence of numbers. 5,6,3,2,10,4,1,7,9,8. Write down the level ordered traversal sequence of the final tree after insert. Delete node 10, 8, and 6 step by step using in-order successor. Write down the level ordered traversal sequence after every delete. I want you to write down (1 level ordered traversal for the insert and 3 level-ordered traversals for the deletes). In total there should be 4 level-ordered traversal sequences in...

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