Upgrade to Pro — share decks privately, control downloads, hide ads and more …

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

Maplewing
October 22, 2013

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

Maplewing

October 22, 2013
Tweet

More Decks by Maplewing

Other Decks in Programming

Transcript

  1. •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
  2. •| 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 |
  3. 插入排序法 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 |
  4. 快速排序法 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
  5. 合併排序法 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
  6. 線性搜尋 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
  7. •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) 質數:跳貳跳肆法
  8. • 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 質數:篩法
  9. • (x1,y1), (x2,y2), (x3,y3), (x4,y4) …… 幾何:多邊形面積 x1 x2 x3

    x4 …….. y1 y2 y3 y4 …….. •實線相乘 •黃色相加 •綠色相減
  10. •113 •10161 •253 •621 •10025 •591 作業:雜題 •107 •573 •846

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