Question

Consider the following code fragment: int i -1; int s=1; while (i <- n) Show that at the start of every iteration holds using induction

Please use induction

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

F(1) = 1*1 = 1 base case is true s=1 //

let F(i) is true

F(i) = S+2*i+1 = i*i

then F(i+1) must be true // induction step

F(i+1) = F(i) + 2*i+1

-> i*i +2*i+1

-> i*i+ i+i+1

->i*(i+1) +(i+1)

->(i+1)*(i+1)

-> (i+1)2

F(i+1) is also true when F(i) is true

hence induction holds

Add a comment
Know the answer?
Add Answer to:
Please use induction Consider the following code fragment: int i -1; int s=1; while (i <-...
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