Correctness of An Algorithm
Is your algorithm correct? Prove that to me!
-
Oh, no~~~ It is NOT correct, what shall I do?
-
YES~~~ It is CORRECT!!!
-
See~~~ Check the output of the test case / Check the test case with the Pseudocode.
IT IS CORRECT!!!
Input test case: [13, 4, 24, 7]
Output: 24
|
-
This time, IT IS CORRECT~~~ What do you say for now!!!
Input test case: [13, 4, 24, 7]
Output: 24
Input test case: [-13, -4, -24, -7]
Output: -4
|
-
Examples / Test cases can only be used to prove that an implemented algorithm is not correct, by discovering inputs where the output is unexpected. However, it cannot prove that an algorithm is correct. [ref]