您的位置:首页 > 其它

The Art Of Computer Programming: 1.1

2014-08-28 15:13 330 查看


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

The Art Of Computer Programming: 1.1



div.org-src-container {
font-size: 85%;
font-family: monospace;
}
pre.src {
background-color:#2e3436;
color:#fefffe;
}

p {font-size: 15px}
li {font-size: 15px}

/*
@licstart The following is the entire license notice for the
JavaScript code in this tag.

Copyright (C) 2012-2013 Free Software Foundation, Inc.

The JavaScript code in this tag is free software: you can
redistribute it and/or modify it under the terms of the GNU
General Public License (GNU GPL) as published by the Free Software
Foundation, either version 3 of the License, or (at your option)
any later version. The code is distributed WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.

As additional permission under GNU GPL version 3 section 7, you
may distribute non-source (e.g., minimized or compacted) forms of
that code without the copy of the GNU GPL normally required by
section 4, provided you include this license notice and a URL
through which recipients can access the Corresponding Source.

@licend The above is the entire license notice
for the JavaScript code in this tag.
*/


Table of Contents

1. Algorithm

1 Algorithm

1.1 算法的特性

算法除了是一套有限的规则 (Being a finite set of rules) 之外,还有如下的五个特性:

有限性 (Finiteness) :需要在有限的步骤内收敛结束。

可定义性 (Definieness) :算法中的每一步骤必要要有精确的定义。

输入 (input) :有 0 或者多数输入

输出 (output) :有 1 或者多个输出

有效性 (Effectiveness) :算法通常是有效的。

1.2 例子



Figure 1: Euclid's alrogithm

Lisp code:

(defun ea (m n)
"Euclid's algorithm"
(interactive)
(let ((r (% m n)))
(if (= r 0)
n
(ea n r))))



(转载请注明出处
使用许可:
署名-非商业性使用-相同方式共享 3.0 中国大陆许可协议 。)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: