What two conditions must hold for an algorithm to be CORRECT?
What two conditions must hold for an algorithm to be CORRECT?
Answer
It halts in finite time, and it outputs the right answer — on every instance
Termination AND a correct output, for every problem instance. Missing either one (loops forever on some input, or sometimes wrong) makes it incorrect.