Question:medium

Loop invariant allows us to understand and prove the correctness of an algorithm. Which of the following options is NOT to be proven, when we prove the correctness of any algorithm using loop invariant?

Show Hint

A loop invariant is essential in proving the correctness of algorithms, especially when it comes to showing that the loop works as expected throughout.
Updated On: Feb 17, 2026
  • Sequence
  • Initialization
  • Maintenance
  • Termination
Show Solution

The Correct Option is C

Solution and Explanation

Step 1: Understanding Loop Invariants.
A loop invariant is a condition that remains true before and after each loop iteration. It serves to demonstrate algorithmic correctness.

- Sequence: Verifies the logical progression of algorithm operations.

- Initialization: Confirms the accurate setup of initial values.

- Maintenance: Establishes that the invariant condition persists throughout each loop iteration.

- Termination: Demonstrates loop termination and the validity of the final condition post-loop.

Step 2: Conclusion.
The Maintenance condition, while demonstrating algorithmic step consistency, is not a condition that requires separate proof when employing a loop invariant. Therefore, the correct choice is (3) Maintenance.

Was this answer helpful?
0