Algorithm Correctness and Termination Flashcards
1
Q
What is algorithm correctness?
A
Proof that an algorithm produces the expected output for all valid inputs.
2
Q
What is termination in algorithms?
A
A property ensuring an algorithm always reaches a stopping condition.
3
Q
What is an invariant in algorithms?
A
A property that remains true at each step of execution (used in loop invariants).
4
Q
How do you prove an algorithm is correct?
A
Using induction or loop invariants.