Question: Which of the following functions returns the second smallest node in a binary search tree r ? find _ smallest ( tree _ node *
Which of the following functions returns the second smallest node in a binary search tree r findsmallesttreenode r function returns the node with smallest value in a tree r If tree r is empty findsmallest returns NULL.
treenode findsecondsmallesttreenode r
if rleftNULL return findsmallestrright;
treenode p findsecondsmallestrleft;
if pNULL return r;
else return p;
treenode findsecondsmallesttreenode r
if rleftNULL return findsmallestrright;
return findsecondsmallestrleft;
treenode findsecondsmallesttreenode r
if rleftNULL return findsmallestrright;
treenode p findsecondsmallestrleft;
if pNULL return r;
else return p;
treenode findsecondsmallesttreenode r
treenode p findsecondsmallestrleft;
if pNULL return r;
else return p;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
