Question

In the following binary search tree, show the resulting binary search tree after deleting Key 25,...

In the following binary search tree, show the resulting binary search tree after deleting Key 25, then key 9.

15

9

25

5

13

30

2

6

10

14

11

(15, 9, 25, 5, 13, 30, 2, 6, 10, 14, 11)

BST after deleting key 25:

BST after deleting key 9:

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

Answer:

here is the tree after deleting 25:

Because the node has only one child, so we can simply replace the node with its child and delete it.

15
9 30
5 13
2 6 10 14
11

Now to delete 9, we have to replace it with its inorder successor which is 10.

So, replacing 9 with 10 forms this:

15
10 30
5 13
2 6 14
11

Hope you like it!

Please upvote and provide comments if you have any doubts!

Add a comment
Know the answer?
Add Answer to:
In the following binary search tree, show the resulting binary search tree after deleting Key 25,...
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
  • 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...

  • Binary Search Trees (a) 5 pointsl Insert 5, 12, 7, 1, 6, 3, 13, 2, 10,...

    Binary Search Trees (a) 5 pointsl Insert 5, 12, 7, 1, 6, 3, 13, 2, 10, 11 into an empty binary search tree in the given order. Show the resulting BST after every insertion. (b) 5 points) What are the preorder, inorder, and postorder traversals of the BST you have after (a)? (c) 5 points Delete 2, 7, 5, 6, 11 from the BST you have after (a) in the given order Show the resulting BST after every deletion.

  • in PYTHON   create a binary search tree that has the minimum possible height (i.e., is as balanced...

    in PYTHON   create a binary search tree that has the minimum possible height (i.e., is as balanced as possible). You're given the elements in sorted order. Here are some example inputs and the minimum possible height of the resulting BST: [0] 0 [-3, -2, -1] 1 [-3, 0, 1, 3, 4] 2 [-9, -6, -5, -3, -2, 1, 2, 4, 8] 3 [-19, -17, -15, -12, -11, -9, -7, -1, 1, 4, 5, 7, 8, 9, 11, 12, 13, 14, 18]...

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

  • 1 Binary Search Trees (25 points) Consider the binary tree as shown in Figure 1. 9...

    1 Binary Search Trees (25 points) Consider the binary tree as shown in Figure 1. 9 5 15 10 17 8 Figure 1: Binary Tree: The letter next to each node (e.g., a, b) denotes the tree node, and the number inside each node is the key. 1.1 Correctness (10 points) Is this binary tree a valid binary search tree? In other words, does it satisfy the binary search tree property? If not, which node(s) violates the binary search tree...

  • Using Binary Search Tree implementation, what would the resulting 'table' look like after inserting key/value pairs:...

    Using Binary Search Tree implementation, what would the resulting 'table' look like after inserting key/value pairs: (a, 1), (x, 5), (m,19), (b, 3), (f, 8).

  • help 2. Do the following problems: Create a binary search tree (BST), with the following words...

    help 2. Do the following problems: Create a binary search tree (BST), with the following words inserted: Int, Char, Return, Break, Float, While, Short, Sort, Double, For, Continue. a. b. Insert the following words into the BST built in (a): Tree, Table, Binary, Network, Visit, Seekk, Traversal c. Where is the minimum key value in a BST? (Give a concrete example) d. Where is the maximum key value in a BST? (Give a concrete example) e. How many comparisons are...

  • Tree & Hash Table & Heap Use the following integer keys 73, 58, 91, 42, 60, 130, 64, 87 to perform the followings: a) Binary Search Tree - Draw a binary search tree - Retrieve the integers ke...

    Tree & Hash Table & Heap Use the following integer keys 73, 58, 91, 42, 60, 130, 64, 87 to perform the followings: a) Binary Search Tree - Draw a binary search tree - Retrieve the integers keys in post-order - Retrieve the integers keys in pre-order - Draw a binary search tree after node 58 is deleted b) Create a Hash Table using the methods described below. Show the final array after all integer keys are inserted. Assumes that...

  • 1.(10 pts) Contrast a heap with a binary search tree by inserting the numbers 60, 30,...

    1.(10 pts) Contrast a heap with a binary search tree by inserting the numbers 60, 30, 40, 50, 20, 10 first in a BST and then in a min-heap. Draw the resulting BST on the left and the heap on the right. You may draw any valid BST or Heap that contain the provided values 2. (5 pts) In section 11.1, the book mentions that heaps are **complete** binary trees, what does that mean? Demonstrate by drawing an example of...

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

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