in DS edited by
6,920 views
0 votes
0 votes
If a node in a BST has two children, then its in-order predecessor has

a) No left child
b) No right child
c) 2 children
d) no child
in DS edited by
6.9k views

4 Comments

Explain plz!
0
0

INORDER OF THIS EXAMPLE IS  3 4 5 6 7 9 17 20 22

TAKE NODE 9.... ITS INORDER PREDECESSOR IS 7... 7 HAS NO RIGHT CHILD...(ANSWER)

0
0
Yes it will be no right child for predecessor, i have read inorder succcessor, for that no left child
0
0

3 Answers

1 vote
1 vote
no right child
by
0 votes
0 votes
Inorder traversal gives sorted sequence. Inorder predecessor will be just the previous max value. So right child should not be there as right child is greater than that node value.
0 votes
0 votes

The answer should be No right child, as if there is a right child then that right child would become inorder predecessor of the node. There may or may not be a left child, because a left child would not affect inorder predecessor of the node.

Related questions