摘要: 循环不变式(loop invariant) We use loop invariants to help us understand why an algorithm is correct. We must show three things about a loop invariant: · Initialization: It is true prior to the first iteration of the loop. · Maintenance: If it is true before an iteration of the loop, it remains true before the next iteration. · Termination: When the loop terminates, the invariant gives us a useful property that helps show that the algorithm is correct. 阅读全文
posted @ 2013-07-19 10:44 永不止步,永无止境 阅读(3745) 评论(0) 推荐(0)