Hi, I'm wondering if anyone could help me understand algorithm correctness. I've read the wiki page, along with lecture slides, but I have no idea how to apply it.
Explaining it on a simple program would be extremely helpful.
This is one simple example someone could explain with.
#include <iostream>
#include <cstdlib>
usingnamespace std;
int main(int argc, char** argv){
int least = atoi(argv[1]);
for(int index = 2; index < argc; index++){
int next = atoi(argv[index]);
if(next < least){
least = next;
}
}
return 0;
}
What I really want to know is if someone asks me to "prove the algorithm's correctness", what exactly would I do?
Any helpful links could possibly help immensely, too!