Multiple choice

What should come in place of ? in the above algorithm?

An algorithm to delete the node/key k from a tree T is given below:
delete(T, k)
{
if(left[k] == null && right[k] == null)
{
K = null;
}
else if(left[k] != null && right[k] == null)
{
if(k == left[parent[k]]) left[parent[k]] == left[k];
else right[parent[k]] = left[k];
 }
else if(left[k] == null && right[k] != null)
{
if(k == left[parent[k]]) left[parent[k]] == right[k];
else right[parent[k]] = right[k];
 }
else Y = ?;
X = y;
Right[x] = left[y];
 }
}

  1. Treemax(T)

  2. Successor(T, k)

  3. Predecessor(T, k)

  4. Treemin(T)

  5. Root[T]

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

This is the correct answer since when both right and left child node of the node to be deleted is not null, then the predecessor of the current node should be connected to the parent node