算法競(jìng)賽實(shí)戰(zhàn)筆記
定 價(jià):78 元
- 作者:梁博 等
- 出版時(shí)間:2024/1/1
- ISBN:9787121470127
- 出 版 社:電子工業(yè)出版社
- 中圖法分類:TP301.6
- 頁(yè)碼:244
- 紙張:
- 版次:01
- 開(kāi)本:16開(kāi)
近年來(lái),隨著互聯(lián)網(wǎng)和人工智能的廣泛應(yīng)用,算法作為其關(guān)鍵技術(shù)的內(nèi)核,備受學(xué)校和企業(yè)的重視,算法競(jìng)賽更成為算法領(lǐng)域的一顆明珠。本書(shū)依托編著者多年算法競(jìng)賽的教學(xué)積累,全方位介紹了競(jìng)賽中常用的算法及近年來(lái)算法競(jìng)賽領(lǐng)域最新的研究成果,基于算法競(jìng)賽中廣泛使用的在線評(píng)測(cè)網(wǎng)站——洛谷,著重介紹線性數(shù)據(jù)結(jié)構(gòu),基礎(chǔ)算法,搜索算法,動(dòng)態(tài)規(guī)劃等方面的知識(shí)。本書(shū)適合對(duì)算法競(jìng)賽感興趣的青少年閱讀,也可作為相關(guān)領(lǐng)域教師、計(jì)算機(jī)專業(yè)學(xué)生的參考用書(shū)。
作者梁博:2019年至今,負(fù)責(zé)北大附中初中信息學(xué)奧賽教學(xué)工作。2022年學(xué)生成績(jī):入選省隊(duì):陳凱豐,謝梓涵,梁嘉文。北京20個(gè)省隊(duì)名額中占3人。(根據(jù)往年情況,進(jìn)入省隊(duì)基本都可以保送清華或者北大)2021年學(xué)生成績(jī):呂彥哲銀牌。陳凱豐(初二)作為夏令營(yíng)選手獲得銀牌,簽約北大,成為歷史上簽約北大最小的選手。2020年學(xué)生成績(jī):學(xué)生中初中組(普及組)參賽人數(shù)60人,一等獎(jiǎng)獲獎(jiǎng)20人,二等獎(jiǎng)25人,北京市7個(gè)滿分同學(xué)中占3人。省一等獎(jiǎng)比例30%遠(yuǎn)超全市平局值,總獲獎(jiǎng)率68%初二即有兩名同學(xué)獲得高中組(提高組)一等獎(jiǎng)。2014-2021在小米負(fù)責(zé)簽名與編譯系統(tǒng)研發(fā),科研成果轉(zhuǎn)化為32項(xiàng)專利,如:CN201510549837.6一種應(yīng)用軟件預(yù)裝次數(shù)的控制方法及裝置CN201510547599.5應(yīng)用版本信息的獲取方法、設(shè)備和系統(tǒng)CN201510857770.2終端系統(tǒng)升級(jí)方法及裝置CN201610694577.6數(shù)字簽名方法及裝置其余28項(xiàng)專利不列出,可以在相關(guān)網(wǎng)站檢索到.2009-2021 浙江大學(xué)竺可楨學(xué)院計(jì)算機(jī)科學(xué)與技術(shù)專業(yè)
第 0 章 一些不那么常識(shí)的常識(shí) ············································································.1
0.1 本地編程環(huán)境的配置··············································································.1
0.1.1 在 Windows 系統(tǒng)上安裝使用 Dev C++···············································.1
0.1.2 在 MacOS 系統(tǒng)上安裝 Xcode ··························································.4
0.2 在線評(píng)測(cè)系統(tǒng)—洛谷···········································································.7
0.2.1 注冊(cè)洛谷 ···················································································.8
0.2.2 提交題目 ···················································································.9
0.2.3 團(tuán)隊(duì)管理 ···················································································11
第 1 章 線性數(shù)據(jù)結(jié)構(gòu) ························································································15
1.1 數(shù)據(jù)結(jié)構(gòu)·····························································································15
1.1.1 數(shù)據(jù)結(jié)構(gòu)的定義 ··········································································15
1.1.2 數(shù)據(jù)結(jié)構(gòu)的運(yùn)算 ··········································································17
1.1.3 線性數(shù)據(jù)結(jié)構(gòu) ·············································································17
1.2 棧······································································································18
1.2.1 棧的定義 ···················································································18
1.2.2 棧的作用 ···················································································20
1.2.3 棧的固定數(shù)組實(shí)現(xiàn) ·······································································21
1.2.4 STL 中的棧 ················································································24
1.2.5 括號(hào)匹配問(wèn)題 ·············································································26
1.2.6 前綴、中綴、后綴表達(dá)式 ······························································30
1.2.7 后綴表達(dá)式的計(jì)算 ·······································································32
1.2.8 中綴表達(dá)式轉(zhuǎn)換為后綴表達(dá)式 ························································36
1.2.9 中綴表達(dá)式的計(jì)算 ·······································································41
1.3 隊(duì)列···································································································43
1.3.1 隊(duì)列的定義 ················································································44
1.3.2 隊(duì)列的作用 ················································································46
1.3.3 隊(duì)列的固定數(shù)組實(shí)現(xiàn) ····································································46
1.3.4 STL 中的隊(duì)列 ·············································································47
1.3.5 基數(shù)排序(Radix Sorting)·····························································50
1.3.6 結(jié)構(gòu)體的構(gòu)造函數(shù) ·······································································56
1.3.7 隊(duì)列的應(yīng)用 ················································································59
1.4 前綴和·······························································································.66
1.4.1 前綴和的引入 ············································································.66
1.4.2 一維數(shù)組前綴和 ·········································································.66
1.5 動(dòng)態(tài)數(shù)組····························································································.75
1.5.1 動(dòng)態(tài)數(shù)組 vector ··········································································.75
1.5.2 STL 中的動(dòng)態(tài)數(shù)組 ······································································.75
1.5.3 vector 的缺點(diǎn) ·············································································.76
1.5.4 vector 與迭代器 iterator·································································.76
1.5.5 vector 與 C++11 ··········································································.78
1.5.6 vector 的實(shí)現(xiàn)原理 ·······································································.80
1.6 樹(shù)·····································································································.82
1.6.1 樹(shù)的相關(guān)概念 ············································································.82
1.6.2 樹(shù)的性質(zhì) ··················································································.84
1.6.3 特殊的樹(shù)—二叉樹(shù) ···································································.84
1.6.4 完全二叉樹(shù)的性質(zhì) ······································································.85
1.6.5 樹(shù)的存儲(chǔ)方式 ············································································.86
1.6.6 樹(shù)的遍歷 ··················································································.89
1.6.7 知二求一 ··················································································101
1.6.8 樹(shù)的寬度優(yōu)先遍歷 ······································································105
1.7 本章習(xí)題····························································································105
第 2 章 基礎(chǔ)算法 ·····························································································106
2.1 貪心算法····························································································106
2.1.1 貪心算法的概念 ·········································································106
2.1.2 基礎(chǔ)貪心問(wèn)題舉例 ······································································107
2.1.3 線段覆蓋問(wèn)題 ············································································111
2.2 高精度計(jì)算·························································································113
2.2.1 C++語(yǔ)言中的數(shù)據(jù)類型·································································113
2.2.2 高精度加法 ···············································································115
2.2.3 高精度減法 ···············································································118
2.2.4 高精度乘法 ···············································································121
2.2.5 高精度除法取余數(shù) ······································································126
2.3 歸并排序····························································································129
2.3.1 歸并 ························································································130
2.3.2 歸并排序的時(shí)間復(fù)雜度分析 ··························································134
2.3.3 歸并排序的應(yīng)用 ·········································································135
2.4 快速排序··························································································.143
2.4.1 快速排序的思想················································································.143
2.4.2 快速排序的時(shí)間復(fù)雜度分析 ························································.146
2.5 STL ································································································.151
2.5.1 algorithm 頭文件中的函數(shù) ···························································.152
2.5.2 容器 ······················································································.156
2.6 本章習(xí)題··························································································.159
第 3 章 搜索算法 ···························································································.160
3.1 深度優(yōu)先搜索····················································································.160
3.1.1 迷宮尋路與烤雞問(wèn)題 ·································································.160
3.1.2 全排列問(wèn)題與回溯 ····································································.166
3.1.3 洪水填充(Flood Fill)算法·························································.168
3.1.4 八皇后問(wèn)題與剪枝 ····································································.171
3.1.5 數(shù)獨(dú)問(wèn)題 ················································································.174
3.1.6 剪枝 ······················································································.177
3.2 寬度優(yōu)先搜索····················································································.181
3.2.1 找眼鏡 ···················································································.181
3.2.2 馬的遍歷 ················································································.182
3.2.3 01 迷宮···················································································.185
3.2.4 八數(shù)碼問(wèn)題 ·············································································.188
3.3 本章習(xí)題··························································································.190
第 4 章 動(dòng)態(tài)規(guī)劃 ···························································································.191
4.1 動(dòng)態(tài)規(guī)劃入門(mén)····················································································.191
4.1.1 斐波那契數(shù)列 ··········································································.191
4.1.2 數(shù)字三角形 ·············································································.193
4.1.3 遞推+填表···············································································.195
4.2 動(dòng)態(tài)規(guī)劃解題步驟··············································································.199
4.2.1 分解子問(wèn)題 ·············································································.199
4.2.2 確定狀態(tài) ················································································.200
4.2.3 狀態(tài)轉(zhuǎn)移 ················································································.200
4.2.4 動(dòng)態(tài)規(guī)劃能解決的問(wèn)題的特點(diǎn) ·····················································.201
4.3 線性動(dòng)態(tài)規(guī)劃····················································································.201
4.3.1 最長(zhǎng)上升子序列問(wèn)題(LIS)·······················································.201
4.3.2 最長(zhǎng)公共子序列問(wèn)題(LCS)······················································.209
4.4 背包類動(dòng)態(tài)規(guī)劃·················································································.213
4.4.1 01 背包問(wèn)題···············································································213
4.4.2 多重背包問(wèn)題 ············································································225
4.4.3 完全背包問(wèn)題 ············································································228
4.4.4 分組背包問(wèn)題 ············································································231
4.4.5 二維費(fèi)用背包問(wèn)題 ······································································241
4.5 區(qū)間動(dòng)態(tài)規(guī)劃與多維動(dòng)態(tài)規(guī)劃·············································································243
4.5.1 區(qū)間動(dòng)態(tài)規(guī)劃 ············································································243
4.5.2 多維動(dòng)態(tài)規(guī)劃 ············································································248
4.6 本章習(xí)題····························································································256