# 計概:問題解決與演算法設計 ## 如何解決問題 >以問題取代未知數、以資訊取代資料、以解待取待理論。 - 一般的問題解決過程 提出問題 <i class="fa fa-long-arrow-right"></i> 尋找熟悉的事物 <i class="fa fa-long-arrow-right"></i> 分割並征服 <i class="fa fa-long-arrow-right"></i> 演算法。 - 電腦的問題解決過程 分析與定義階段 <i class="fa fa-long-arrow-right"></i> 演算法開發階段 <i class="fa fa-long-arrow-right"></i> 實作階段 <i class="fa fa-long-arrow-right"></i> 維護階段。 --- ## 簡單變數演算法 - 可選擇的演算法:IF THEN ELSE。 ### 重複演算法 - 技術控制型迴圈 - 由三部分組成:起始化、測試、增量。 ``` set count to 0 WHILE(count < limit) … count ← count + 1 … ``` - 事件控制型迴圈 - 巢狀結構 ``` WHILE(count < limit) IF(value<0) … … ``` --- ## 複合變數 - 陣列:為同性質項目的集合。 - 索引 index:由0開始,代表位置。 - 陣列名字[index] - 紀錄:為不同性質項目的集合。 - 名字.欄位名稱 --- ## 搜索演算法 二元搜索:由以排序過的陣列搜索,每次與中間比較,再將搜索範圍減半,直到找到答案。 ## 排序 泡沫排序:每次由最後一項與前一項相比,若比較小則交換,直到最前;若從底至頭都沒有需要交換,則排序結束。 ## 遞迴演算法 分為兩種狀況:底層狀況、一般狀況。 - 副程式敘述:將一段程式碼命名,並移至外部;有回傳值的,也有不回傳值的。 --- ## 重要的串連思路 - 資訊隱藏 - 抽象概念 - 為事件命名 - 測試 ###### tags: `計算機概論`
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up