Algorithm and Prove it's correctness

1. Please see the attachment. Give an iterative algorithm

2. Prove your algorithm by using loop invariant. You must show four things for the proof:

a. Loop Invariant

b. Initialization

c. Maintenance

4. Termination

Tags: No tags