How do I prove an algorithm is correct?
Usually with a loop invariant for iterative algorithms, or induction for recursive ones. State what is true before the loop, show it stays true through each iteration, and show what that gives you when the loop ends. It is a written argument rather than a test result.
This comes up on Data Structures and Algorithms, where it is answered in the context of the work itself.
Not what you asked?
Ask us the actual question
Send the draft, the rubric or the score report with it. You get a real answer and a price before you commit to anything.