Maplewing
October 22, 2013

# 師大資工系ACM-ICPC讀書會：貳、排序搜尋與數學基礎

October 22, 2013

## Transcript

3. ### •2 5 8 7 6 3 9 •2 5 7

8 6 3 9 •2 5 7 6 8 3 9 •2 5 6 7 8 3 9 •2 5 6 7 3 8 9 •2 5 6 3 7 8 9 泡沫排序法 Bubble Sort •2 5 3 6 7 8 9 •2 3 5 6 7 8 9
4. ### •| 2 5 8 7 6 3 9 •2 |

5 7 8 6 3 9 •2 3 | 7 8 6 5 9 •2 3 5 | 8 6 7 9 •2 3 5 6 | 8 7 9 •2 3 5 6 7 | 8 9 選擇排序法 Selection Sort •2 3 5 6 7 8 | 9 •2 3 5 6 7 8 9 |
5. ### 插入排序法 Insertion Sort •| 2 5 8 7 6 3

9 •2 | 5 7 8 6 3 9 •2 5 | 7 8 6 3 9 •2 5 7 | 8 6 3 9 •2 5 7 8 | 6 3 9 •2 5 6 7 8 | 3 9 •2 3 5 6 7 8 | 9 •2 3 5 6 7 8 9 |
6. ### 快速排序法 Quick Sort •2 5 8 7 6 3 9

•2 3 5 8 7 6 9 •2 3 5 8 7 6 9 •2 3 5 7 6 8 9 •2 3 5 6 7 8 9 •2 3 5 6 7 8 9 •2 3 5 6 7 8 9
7. ### 合併排序法 Merge Sort •2 5 8 7 6 3 9

•2 5 8 7 6 3 9 •2 5 7 8 3 6 9 •2 5 7 8 3 6 9 •2 5 7 8 3 6 9 •2 3 5 6 7 8 9
8. ### 線性搜尋 Linear Search (Find: 8) •2 3 5 6 7

8 9 •2 3 5 6 7 8 9 •2 3 5 6 7 8 9 •2 3 5 6 7 8 9 •2 3 5 6 7 8 9 •2 3 5 6 7 8 9 •2 3 5 6 7 8 9
9. ### 二元搜尋 Binary Search (Find: 8) •必定先排序好！ •2 3 5 6

7 8 9 •2 3 5 6 7 8 9

12. ### •340 •10420 •10474 •152 •299 •120 作業 •156 •400 •123

•10194 •755 •10785

15. ### •6n, 6n+1, 6n+2, 6n+3, 6n+4, 6n+5 •6n: 2*(3n) •6n+2: 2*(3n+1)

•6n+3: 3*(2n+1) •6n+4: 2*(3n+2) 質數：跳貳跳肆法
16. ### • 2, 3, 4, 5, 6, 7, 8, 9, 10,

11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23 • 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23 • 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23 • 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23 • 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23 • 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23 • 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23 • 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23 • 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23 • 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23 • 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23 質數：篩法
17. ### • (x1,y1), (x2,y2), (x3,y3), (x4,y4) …… 幾何：多邊形面積 x1 x2 x3

x4 …….. y1 y2 y3 y4 …….. •實線相乘 •黃色相加 •綠色相減

24. ### •113 •10161 •253 •621 •10025 •591 作業：雜題 •107 •573 •846

•10499 •10790 •11044 •10719 •10177 •10916 •10970 •10014