The base case

Consider the following recursive function: (2, 3, 4, 6)

void funcEx8(int u, char v) //Line 1

//Line 2

    if (u == 0) //Line 3

        cout < u=””>< “=”” “;=”” line=””>

    else //Line 5

    //Line 6

        int x = static_cast(v); //Line 7

        if (v < ‘a’)=”” line=””>

            v = static_cast(x + 1); //Line 9

         else if (v > ‘Z’) //Line 10

            v = static_cast(x – 1); //Line 11

        cout < v=””>< “=”” “;=”” line=””>

        funcEx8(u – 2, v); //Line 13   

//Line 14

//Line 15

Answer the following questions:

a. Identify the base case.

b. Identify the general case.

c. If funcEx8(26, ‘$’); is a valid call, what is the output? If not, explain why.

d. If funcEx8(11, ‘B’); is a valid call, what is the output? If not, explain why.

e. If funcEx8(18, ‘^’); is a valid call, what is the output? If not, explain why.

WhatsApp
Hello! Need help with your assignments?

For faster services, inquiry about  new assignments submission or  follow ups on your assignments please text us/call us on +1 (251) 265-5102

🛡️ Worried About Plagiarism? Run a Free Turnitin Check Today!
Get peace of mind with a 100% AI-Free Report and expert editing assistance.

X