kinoe_T
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.

      Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Explore these features while you wait
      Complete general settings
      Bookmark and like published notes
      Write a few more notes
      Complete general settings
      Write a few more notes
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.

    Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Explore these features while you wait
    Complete general settings
    Bookmark and like published notes
    Write a few more notes
    Complete general settings
    Write a few more notes
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # Algorithm Chapter 3 - Growth of Functions ## Asymptotic notation ### $O$-notation ![](https://i.imgur.com/kiWxqjM.png) > Figure 1. 圖中比較上面的那個函數是 $cg(n)$, 比較下面的函數是 $f(n)$。 $g(n)$ 是 $f(n)$ 的漸進上限。 * $O(g(n)) = \{f(n): \text{there exist positive constants } c \text{ and } n_0 \text{ s.t.} 0 \leq f(n) \leq cg(n) \text{ for all } n \geq n_0\}$ * 白話文: $O(g(n))$ 是一個函數的集合,這個集合裡面的每一個函數,在參數大到某一個程度 ($n_0$) 過後,其函數值都無法超過 $g(n)$ 的某整數倍 ($c$) * 此時,我們稱 $g(n)$ 是 $f(n)$ 的**漸進上限 (asymptotic upper bound)** * 如果 $f(n) \in O(g(n))$, 則我們會直接寫作 $f(n) = O(g(n))$ * 舉例:以下函數都是在 $O(n^2)$ 裏面的函數 * $n^2$ * $n^2 + n$ * $n^2 + 1000n$ * $1000n^2 + 1000n$ * $n$ * $n / 1000$ * $n^{1.99999}$ * $n^2/lg(lg(lg(n)))$ ### $\Omega$-notation ![](https://i.imgur.com/kiWxqjM.png) > Figure 2. 圖中比較下面的那個函數是 $cg(n)$, 比較上面的函數是 $f(n)$。 $g(n)$ 是 $f(n)$ 的漸進下限。 * $\Omega(g(n)) = \{f(n): \text{there exist positive constants } c \text{ and } n_0 \text{ s.t.} 0 \leq cg(n) \leq f(n) \text{ for all } n \geq n_0\}$ * 白話文: $O(g(n))$ 是一個函數的集合,這個集合裡面的每一個函數,在參數大到某一個程度 ($n_0$) 過後,其函數值都不小於 $g(n)$ 的某整數倍 ($c$) * 此時,我們稱 $g(n)$ 是 $f(n)$ 的**漸進下限 (asymptotic lower bound)** * 如果 $f(n) \in \Omega(g(n))$, 則我們會直接寫作 $f(n) = \Omega(g(n))$ * 舉例:以下函數都是在 $\Omega(n^2)$ 裏面的函數 * $n^2$ * $n^2 + n$ * $n^2 - n$ * $n^2 + 1000n$ * $n^2 - 1000n$ * $1000n^2 + 1000n$ * $n^3$ * $n^{2.00001}$ * $n^2/lg(lg(lg(n)))$ * $2^{2^n}$ ### $\Theta$-notation ![](https://i.imgur.com/kFkt22O.png) > Figure 3. 圖中的函數由上到下是 $c_2g(n)$, $f(n)$ 和 $c_1g(n)$。 $g(n)$ 是 $f(n)$ 的漸進上下限。 * $\Theta(g(n)) = \{f(n): \text{there exist positive constants } c_1, c_2 \text{ and } n_0 \text{ s.t.} 0 \leq c_1g(n) \leq f(n) \leq c_2g(n) \text{ for all } n \geq n_0\}$ * 白話文: $O(g(n))$ 是一個函數的集合,這個集合裡面的每一個函數,在參數大到某一個程度 ($n_0$) 過後,其函數值都會介於 $g(n)$ 的某整數倍 ($c_1$) 到另一個整數倍 ($c_2$) 之間 * 此時,我們稱 $g(n)$ 是 $f(n)$ 的**漸進上下限 (asymptotic tight bound)** * 如果 $f(n) \in \Theta(g(n))$, 則我們會直接寫作 $f(n) = \Theta(g(n))$ * $f(n) = \Theta(g(n))$, 若且唯若 $f(n) = O(g(n)) \land f(n) = \Omega(g(n))$ ### $o$-notation * $o(g(n)) = \{f(n): \text{for all positive constants } c > 0 \text{, there exists a constant } n_0 > 0 \\\text{ such that } 0 \leq f(n) < cg(n) \text{ for all } n \geq n_0\}$ * 白話文: $o(g(n))$ 是一個函數的集合,無論 $g(n)$ 乘上哪一個正數 ($c$),這個集合裡面的每一個函數總是會從某個數字開始 ($n_0$),其函數值永遠都小於(沒有等於) $cg(n)$ * 更好懂的版本: $\displaystyle{\lim_{x \to \infty}} \frac{f(x)}{g(n)} = 0$ * 舉例:以下函數都是在 $o(n^2)$ 裏面的函數 * $n^{1.9999}$ * $\frac{n^2}{lg(n)}$ * 舉例:以下函數都**不是**在 $o(n^2)$ 裏面的函數 * $n^2$ * $\frac{n^2}{1000}$ ### $\omega$-notation * $\omega(g(n)) = \{f(n): \text{for all positive constants } c > 0 \text{, there exists a constant } n_0 > 0 \\\text{ such that } 0 \leq cg(n) < f(n) \text{ for all } n \geq n_0\}$ * 白話文: $o(g(n))$ 是一個函數的集合,無論 $g(n)$ 乘上哪一個正數 ($c$),這個集合裡面的每一個函數總是會從某個數字開始 ($n_0$),其函數值永遠都大於(沒有等於) $cg(n)$ * 更好懂的版本: $\displaystyle{\lim_{x \to \infty}} \frac{f(x)}{g(n)} = \infty$ ## Asymptotic notation in equations 略。 ## Comparisons of functions ### Relational properties * 遞移性 (Transitivity) * 若 $f(n) = \Theta(g(n))$ 且 $g(n) = \Theta(h(n))$, 則 $f(n) = \Theta(h(n))$ * 於 $O$、 $\Omega$、 $o$、 $\omega$ 同理 * 自反性 (Reflexivity) * $f(n) = \Theta(f(n))$ * 於 $O$、 $\Omega$ 同理 * 對稱性 (Symmetry) * $f(n) = \Theta(g(n))$, 若且唯若 $g(n) = \Theta(f(n))$ * 轉置對稱性 (Transpose Symmetry) * $f(n) = O(g(n))$, 若且唯若 $g(n) = \Omega(f(n))$ * $f(n) = o(g(n))$, 若且唯若 $g(n) = \omega(f(n))$ ### Comparisons * 若 $f(n) = o(g(n))$, 則 $f(n)$ 漸進小於 $g(n)$ * 若 $f(n) = \omega(g(n))$, 則 $f(n)$ 漸進大於 $g(n)$ * 這樣的比較是**沒有三一律**的。雖然直覺上來說,我們可能會把 $O$ 想成是 $\leq$, $\Omega$ 想成是 $\geq$, 但函數並不像一般的實數,有時候函數是無法拿來比大小的 * 例如: $n^{1+sin(n)}$ 和 $n$ 無法比大小,因為 $1 + sin(n)$ 會在 0 到 2 之間不斷振盪 ## Standard notations and common functions ### Monotonicity * 若 $m \leq n$ 時 $f(m) \leq f(n)$, 則我們說 $f(n)$ 是單調遞增 (monotonically increasing) 的函數 * 若 $m \leq n$ 時 $f(m) \geq f(n)$, 則我們說 $f(n)$ 是單調遞減 (monotonically decreasing) 的函數 * 若 $m < n$ 時 $f(m) < f(n)$, 則我們說 $f(n)$ 是嚴格遞增 (strictly increasing) 的函數 * 若 $m < n$ 時 $f(m) > f(n)$, 則我們說 $f(n)$ 是嚴格遞減 (strictly decreasing) 的函數 後面是高中數學(???)

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password
    or
    Sign in via Facebook Sign in via X(Twitter) Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    By signing in, you agree to our terms of service.

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully