Top "Proof-of-correctness" questions

Formal mathematical argument that an algorithm meets its specification, i.e. it always produces the correct output for any permitted input.

Proof of correctness: Algorithm for diameter of a tree in graph theory

In order to find the diameter of a tree I can take any node from the tree, perform BFS to …

algorithm tree graph-theory proof-of-correctness
Writing a proof for an algorithm

I am trying to compare 2 algorithms. I thought I may try and write a proof for them. (My math sucks, …

algorithm proof proof-of-correctness
How to find the loop invariant and prove correctness?

int i, temp; a is an array of integers [1...100] i = 1; while i < 100 if a[i] > a[i+1] temp = …

algorithm loops proof loop-invariant proof-of-correctness