Algorithms & Data Structures
Sorting, trees, hashing, graph algorithms, KMP, LeetCode practice and algorithm analysis teaching materials.
問題是什麼
3-SAT 布林可滿足性Boolean Satisfiability --- Backtracking DPLL 史上第一個被證明 NP-Complete 的問題:給一堆「三選一」的條件,找出讓全部條件成立的真假指派
Read article →問題是什麼
0/1 背包問題0/1 Knapsack --- Dynamic Programming Branch-and-Bound 容量有限、每件物品拿或不拿:NP-Hard 卻有偽多項式解法的代表作
Read article →問題是什麼
Subset Sum 與 Partition ,pdfauthor=Algorithms Teaching Series
Read article →問題是什麼
N 皇后問題N-Queens --- The Gateway to Backtracking 回溯法的「Hello World」:學會在死路上及早回頭,一輩子受用
Read article →問題是什麼
圖著色問題Graph Coloring --- Backtracking Greedy Heuristics 相鄰的點不能同色,最少要幾種顏色?從排課到暫存器分配都是它
Read article →問題是什麼
頂點覆蓋問題Vertex Cover --- Exact FPT Branching 2-Approximation 用最少的守衛看住所有走廊:FPT 分支與「保證不超過兩倍」的近似法的最佳教室
Read article →問題是什麼
Independent Set 與 Clique ,pdfauthor=Algorithms Teaching Series
Read article →問題是什麼
Hamiltonian Path:狀態壓縮 DP ,pdfauthor=Algorithms Teaching Series
Read article →問題是什麼
旅行推銷員問題TSP --- Held--Karp DP Nearest-Neighbor + 2-opt 最著名的 NP-Hard 問題:精確解的極限在哪、啟發式又能多接近最優
Read article →問題是什麼
集合覆蓋問題Set Cover --- The Greedy n Approximation 用最少的集合蓋住全部元素:貪心法的近似保證與它「已是最優」的驚人事實
Read article →問題是什麼
裝箱問題Bin Packing --- First Fit Decreasing (FFD) 固定容量的箱子最少用幾個:從搬家打包到雲端 VM 調度,以及「先放大件」的智慧
Read article →問題是什麼
工作排程問題Job Scheduling --- Graham's List Scheduling LPT n 個工作分給 m 台機器、最晚完工時間最短:近似演算法理論的誕生地(Graham 1966)
Read article →核心思想
Genetic Algorithm:遺傳演算法 ,pdfauthor=Algorithms Teaching Series
Read article →前言:這份教材要回答的三個問題
rgb0.975,0.975,0.96 rgb0.30,0.55,0.30 rgb0.10,0.20,0.70 rgb0.62,0.15,0.55 rgb0.55,0.55,0.55 rgb0.42,0.16,0.48 rgb0.90,0.94,0.99 rgb0.99,0.93,0.93 rgb0.92,0.97,0.92 rgb0.995,0.97,0.88
Read article →Balanced Binary Search Tree — AVL Tree、RedBlack Tree、由遍歷重建樹
Part I — AVL Tree 1. AVL Tree 定義與性質1avltree定義與性質 2. Balance Factor 與高度2balancefactor與高度 3. AVL 的四種旋轉3avl的四種旋轉 4. AVL 插入4avl插入 5. AVL 刪除5avl刪除 6. AVL 完整範例推演6avl完整範例推演
Read article →銀行系統前後端完整教學 — 架構、流程、API、安全與交易一致性
本教材從工程角度介紹一個現代銀行系統如何設計前端、後端、資料庫、交易流程、安全控管與 API。 內容適合作為系統設計、金融科技後端、全端開發與面試準備教材。 注意:真實銀行系統會受到法規、內控、資安稽核與核心銀行主機限制,本教材以教學用架構為主,不構成金融或法遵建議。
Read article →CS3334 Project: Find the Most Frequent Duplicate
Given a list of integers, find the most frequent duplicate element. A "duplicate" is an element that appears more than once. Among all duplicates, return the one with the highest frequency. If two or more duplicates shar
Read article →Chapter 2: Algorithm Analysis — Comprehensive Teaching Materials
Source: Data Structures and Algorithm Analysis in C++, 4th Edition, Mark Allen Weiss
Read article →Disjoint Set(並查集 / UnionFind)演算法完整教學
1. Disjoint Set 簡介與動機1disjointset簡介與動機 2. 基本術語與資料結構2基本術語與資料結構 3. 三大基本操作3三大基本操作 4. 實作 1:Quick Find(陣列直接記錄群編號)4實作1quickfind陣列直接記錄群編號 5. 實作 2:Quick Union(樹狀父節點表示)5實作2quickunion樹狀父節點表示 6. 優化 1:Union by Size / Union by Rank6優
Read article →模糊搜尋(Fuzzy Search / Approximate String Matching)— 完整教材
從「字串距離」到「近似匹配演算法」與「索引結構」,一份內含 9 個手動推演例子、完整可編譯 C++ 程式碼的中階教材。
Read article →前言:為什麼要學圖論演算法
rgb0.975,0.975,0.96 rgb0.30,0.55,0.30 rgb0.10,0.20,0.70 rgb0.62,0.15,0.55 rgb0.55,0.55,0.55 rgb0.13,0.33,0.55 rgb0.95,0.96,0.98 rgb0.90,0.94,0.99 rgb0.99,0.93,0.93 rgb0.92,0.97,0.92
Read article →Hash 演算法 — 完整教材(概念到應用)
本教材依「資料結構用的 Hash」與「密碼學用的 Hash」兩條主線編排,並對應 Hash/cpp/ 內的 C++ 範例程式。
Read article →KMP KnuthMorrisPratt 字串匹配演算法 — 完整教學
1. 問題定義1問題定義 2. 暴力法(Brute Force)及其缺點2暴力法bruteforce及其缺點 3. KMP 的核心思想3kmp的核心思想 4. 前綴函數(Failure Function / Partial Match Table)4前綴函數failurefunctionpartialmatchtable 5. 前綴函數的建構過程5前綴函數的建構過程 6. KMP 搜尋過程6kmp搜尋過程 7. 完整手動推演範例7完整手
Read article →Knuth–Morris–Pratt KMP 字串匹配演算法 — 完整教材
適用對象:演算法初學者到中階;含完整理論、6 個手動推演例子、可編譯的 C++ 程式碼,以及進階應用。
Read article →