算法导论第二章中的原文是:We state these properties of A[1 ‥ j -1] formally as a loop invariant。其中举的例子是插入排序,每次循环从数组A中取出第j个元素插入有序区A[1 .. j-1],然后递增j。这样A[1 .. j-1]的有序性始终得到保持,这就是所谓的“循环不变”了。 这个概念主要用来检验算法的正确性。原文如下: We use loop invariants to help us understand why an algorithm is correct. We must show three things about a loop invariant: