全部书籍

专业

应用 关于 Coach 登录 开始阅读

书籍暂未推出简体中文版——当前显示英文版。

Computer Science · 术语表

什么是 Variant, termination?

又称: termination · variant (loop variant)

Definition 16.1 High School Computer Science · 第 16 章 — Proving Algorithms Correct

An algorithm has the property of termination if it stops on every input that meets its precondition. A variant of a loop is a whole number, computed from the variables, that is never negative while the loop runs and that strictly decreases at each turn.

The variant of gcd(233, 144), from the run above: a staircase that only goes down, one step per turn, and cannot go below 0.
The variant of gcd(233, 144), from the run above: a staircase that only goes down, one step per turn, and cannot go below 00.
在原文中阅读 →