- 2
- 0
- 约1.95万字
- 约 11页
- 2017-05-27 发布于天津
- 举报
演算法的复杂度-时间与结果的考量.PDF
演算法的複雜度-時間與結果的考量
劉炯朗,謝禎鋐
國立清華大學資工系
liucl@mx.nthu.edu.tw
pentel@nthucad.cs.nthu.edu.tw
為了要以簡單,共通的方法算出問題的答案,人們發現問題中存在的規律性
後就將其定為所謂的公式,一旦找出公式後,只要將問題的資料代入對映的公式
中就能得到正確的答案,經由此種方式 ,人們對於許多相同的問題就能在很短的
時間算出,例如有名的牛頓定律F=ma ,狹義相對論中的愛因斯坦定律E= mc 2 ,
和工業界的摩爾定律D= c2m / 18 等 ,根據 Alan Turing (1912 -1954) 所提出的
Turing Machine ,可知公式都是可算的函數(computable functions) ,簡單的描述
Turing Machine 架構如下:將某個問題的計算規則都輸入 Turing Machine 後,在一
條無限長的帶子(可前後移動)打上此問題的input data ,Turing Machine 可將之讀
入並把output data 打在帶子上 ,將正確的規則輸入 Turing Machine 後,Turing
Machine 能算出的問題 ,都是computable 。
無限長
的帶子
Turing Machine
Read –write head
但不是所有的函數Turing Machine 都算的出來 ,還是有不可算的函數
(non-computable functions) ,就舉個最基本的問題作為例子,假設存在一個程式(T)
會將任何程式(P)和其input data(D)當成自己的input data 然後判斷出那個程式是
否最後能停止而不會跑進無窮迴圈 ,則
program(P) print WILL STOP ,stops
T
+
Data(D) print WILL NOT STOP ,stops
program(P) print WILL STOP ,enters an infinite loop
T′
+ t
Data(D) print WILL NOT STOP ,stops
If P+P will stop ,enters an infinite loop
C P+P T′
P
If P+P will not stop ,stops
If P+P will stop ,enters an infinite loop
P Q
If P+P will not stop ,stops
If Q+Q will stop ,enters an infinite loop
Q Q
If Q+Q will not stop ,stops
由上圖可知
原创力文档

文档评论(0)