第一課、基本技巧


Syllabus

  • 函式

  • 全域變數

  • 二分搜

  • 排序

  • 前綴和


在開始之前:時間複雜度

  • 演算法存在的目的:速度


函式


什麼是函式?

  • 打包好的程式

  • 用以精簡版面

  • 使程式更容易理解

  • 常使用於複雜的資料結構,如:Segment Tree


如何寫一個函式?


首先,你必須了解全域與區域

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →


全域變數的好處

  • 可儲存資料範圍大
  • 哪都可以用(不用引入)

全域與區域的比較


全域變數 區域變數
Text Text Text