同一個演算法在不同等級的電腦上跑,效率可能會有所不同,我們可以透過比較科學的方式,就是計算時間複雜度(Time Complexity)與空間複雜度(Space Complexity)來判斷演算法好壞。 時間複雜度 衡量程式執行的速度 介紹 時間複雜度可以使用Big O Notation來展示複雜度的趨勢,Big-Ο代表演算法時間函式的上限(Upper bound),而在最壞的狀況下,演算法的執行時間不會超過Big-Ο。 那該如何計算Big O Notation,有三個規則:
5/23/2024(圖片來自於The Algorithm of an Algorithm)
1/2/2024最小生成樹(Minimum Spanning Tree,MST)是指在一個帶權無向圖中,找到一棵包含所有節點,權值最小的樹。其中,權值是指樹中所有邊權重的總和。
7/21/2023C# Q1. In which of these situations are interfaces better than abstract classes? [ ] When you need to define an object type's characteristics, use an interface. When you need to define an object type's capabilities, use an abstract class. [ ] Interfaces are a legacy of older versions of C#, and are interchangeable with the newer abstract class feature. [x] When you need a list of capabilities and data that are classes-agnostic, use an interface. When you need a certain object type to share characteristics, use an abstract class. [x] You should use both an interface and an abstract class when defining any complex object. Q2. Which statement is true of delegates? [x] Delegates are not supported in the current version of C# [x] They cannot be used as callbacks.
6/9/2023or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up