運算
簡例 改
舉個簡單例子說明,好似係以下呢段用粵文寫嘅演算法(虛擬碼)噉,就做咗一連串嘅運算[2]:
- 要解決嘅問題:家吓俾一列正數(輸入)你,假設呢個列唔係一個空列,同我搵嗰列數入面最大嗰個出嚟。
- 用嘅演算法嘅步驟:
- 設一個變數,叫佢做「max」,並且將佢個數值設做「0」;
- 將收到嗰列正數逐個逐個攞嚟同 max 比較吓;
- 如果撞到一個大過 max 嘅數(叫呢個數做「x」)嘅話,將 max 嘅數值設做 x,並且繼續將 max 同下個正數比較吓;(邏輯代數)
- 將最後得出嗰個 max 嘅數值俾出嚟(輸出)。max 嘅數值會係成列數入面最大嗰個。
呢個演算法用 Python(1991 年出嘅一種程式語言)寫出嚟嘅話會係[2]:
# Input:一列冧巴,叫列冧巴做「L」。
# Output:L 入面最大嘅冧巴。
def find_max (L):
max = 0 # 設最大值做 0。
for x in L: # 同 L 入面每個元件做以下嘅嘢...
if x > max: # 如果 x 大過最大值...
max = x # ... 設最大值做 x。
return max # 做完嗮上述嘅嘢後,俾返個最大值出嚟。
研究運算嘅領域係電腦科學(computer science),而運算理論係電腦科學一個高度理論化嘅子領域:電腦科學會研究運算嘅應用,研究點用電腦運算造出有經濟價值嘅產品同技術,例如電腦圖像學(CG)研究電腦圖像-用電腦嘅運算功能造圖像嘅技術,而呢啲圖像可以用嚟製作電腦動畫等嘅產品;但另一方面,電腦科學又會用好似數學噉嘅方法研究運算呢家嘢嘅本質-做呢啲研究嘅電腦科學子領域就係運算理論(theory of computation)[3][4]。
睇埋 改
攷 改
- ↑ Computation in Physical Systems. Stanford Encyclopedia of Philosophy.
- ↑ 2.0 2.1 Background: Algorithms 互聯網檔案館嘅歸檔,歸檔日期2018年7月3號,..
- ↑ Denning, P.J.; Comer, D.E.; Gries, D.; Mulder, M.C.; Tucker, A.; Turner, A.J.; Young, P.R. (January 1989). "Computing as a discipline". Communications of the ACM. 32: 9–23.
- ↑ Turner, Raymond, Angius, Nicola , Primiero, Giuseppe. (Spring 2019). "The Philosophy of Computer Science", The Stanford Encyclopedia of Philosophy, Edward N. Zalta (ed.),
拎 改
- Theory of Computation at MIT.
- Theory of Computation at Harvard.