Question

10. (10 points) Computational problem solving: Proving correctness: Function g (n: nonnegative integer) if n si then return(n

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Base Case:

Let us assume that n = 1.

Hence, function g returns 1 since n <= 1.

Now, 3n - 2n = 3 - 2 = 1

Clearly, the equality is satisfied for base case n = 1.

Inductive Hypothesis:

Let us assume that for n <= k, the function g(k) returns 3k - 2k and g(k-1) = 3k-1 - 2k-1

Inductive Step:

Now, we would need to show that for n = k + 1, the function g(k + 1) returns 3k+1 - 2k+1.

Proof:

g(k + 1) = 5*g(k) - 6*g(k-1)

= 5 * (3k - 2k) - 6(3k-1 - 2k-1)

= 15*3k-1 - 10*2k-1 - 6*3k-1 + 6*2k-1

= 9*3k-1 - 4*2k-1

= 3k+1 - 2k+1 (proved)

Add a comment
Know the answer?
Add Answer to:
10. (10 points) Computational problem solving: Proving correctness: Function g (n: nonnegative integer) if n si...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT