Examveda

Which of the following should be the base case for the recursive solution of a set partition problem?

A.

If(sum%2!=0)
   return false;
if(sum==0)
   return true;

B.

If(sum%2!=0)
   return false;
if(sum==0)
   return true;
if (n ==0 && sum!= 0) 
   return false; 

C.

if (n ==0 && sum!= 0) 
    return false; 

D.

if(sum<0)
   return true;
if (n ==0 && sum!= 0) 
   return false; 

Answer: Option B


This Question Belongs to Data Structure >> Miscellaneous On Data Structures

Join The Discussion

Related Questions on Miscellaneous on Data Structures