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