Question

Consider the following BST: 50 30 70 20 40 60 80 15 35 65 36 64 66

QUESTION 32 child of node Referring to the tree above, the value 62 would be inserted as the (left or right) left or right: n

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

Solution:

(32)

=>Node to be inserted = 62

The answers will be:

left of right: left

node: 64

Explanation:

=>In binary search tree(BST) a node with value less than node is inserted at the left part of root otherwise right part of the node.

=>The above property is being followed for every node of the tree.

=>62 > 50 hence it will be inserted at the right side of 50.

=>62 < 70 hence it will be inserted at the left side of 70.

=>62 > 60 hence it will be inserted at the right side of 60.

=>62 < 65 hence it will be inserted at the left side of 65.

=>62 < 64 hence it will be inserted at the left side of 64.

(33)

The answers will be:

Predecessor: 40

Successor: 60

Explanation:

Finding predecessor of 50:

=>Predecessor of a node is the maximum value in the left subtree of that node.

=>Precessor of 50 = 40

Finding successor of 50:

=>Successor of a node is the minimum value in the right subtree of that node.

=>Successor of 50 = 60

(34)

=>Successor is used for deleting the nodes.

=>Nodes to be deleted in order = 80, 40, 50

Explanation:

BST: 170 40 60 20 (65) (64 66) Delete soi leaf uide to just delete it: Bol 40 20 64 06 Delele you there is no tuleessor of 40

36 20 35 66 65 66) Delete SD: successor of so = 60 U 20 36 (64 66 (13) cfinal BST level order traversal = 60, 30,90, 29, 35,6

I have explained each and every part with the help of statements as well as images attached to the answer above.

Add a comment
Know the answer?
Add Answer to:
Consider the following BST: 50 30 70 20 40 60 80 15 35 65 36 64...
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
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