Computer Science, asked by sairohith7995, 5 months ago

Consider a BST containing two nodes. 40 and 60. It is given that 40 is the root node. Now 80 is inserted in the BST. Identify the correct statement
Statement 1: RR rotation is best suited here to make the tree balanced
Statement 2 : After the Insertion, the tree has become Imbalanced
Statement 3: After the insertion the balance factor of exactly two nodes becomes negative
Statement 4: All statements are true
Options
Statement 1
OOO
Slalement 1 & 3
Statement 2 & 3
Slalement 4​

Answers

Answered by lakshitatihskal5528
0

Explanation:

hy guys

I am in leaderboard so I am informing u that

do not join any link given in brainly

kyuki brainly me hackers aaye h

vo kisi ki bhi id se aapka phone hack kr skte h

thank you

Answered by rahul123437
0

Statement 4 is the correct statement.

Explanation:

  • Statement 1:RR rotation is best suited here to make the tree balanced.

BINARY SEARCH TREE is a node-based binary tree that further has right and left subtree that too is binary search tree, where right subtree is always greater than root and left subtree is always less than root.

If a BST contains two nodes 40 and 60, given that 40 is the root node. If we insert 80, the tree looks like this:

Hence, RR rotation is best suited here to make the tree balanced.

  • Statement 2: After the Insertion, the tree has become Imbalanced.

After inserting 80, we see that the tree is right BST and the root node is imbalanced. The root node 40 has a balance factor 2(balance factor: the difference between heights of left and right subtrees cannot be more than one for all nodes.)

  • Statement 3: After the insertion the balance factor of exactly two nodes becomes negative.

The root node 40 has a balanced factor(0-2=-2)

The balance factor of node 60 is(0-1=-1)

Hence, After the insertion of root 80, the balance factor of exactly two nodes becomes negative.

Attachments:
Similar questions