- Go Systems Programming
- Mihalis Tsoukalos
- 239字
- 2021-07-02 18:08:05
The Big O notation
The Big O notation is used for describing the complexity of an algorithm, which is directly related to its performance. The efficiency of an algorithm is judged by its computation complexity, which mainly has to do with the number of times the algorithm needs to access its input data to do its job. Usually, you would want to know about the worst-case scenario and the average situation.
So, an O(n) algorithm, where n is the size of the input, is considered better than an O(n2) algorithm, which is better than an O(n3) algorithm. However, the worst algorithms are the ones with an O(n!) running time because this makes them almost unusable for inputs with more than 300 elements. Note that the Big O notation is more about estimating and not about giving an exact value. Therefore, it is largely used as a comparative value and not an absolute value.
Also, most Go lookup operations in built-in types, such as finding the value of a map key or accessing an array element, have a constant time, which is represented by O(1). This means that built-in types are generally faster than custom types and that you should usually prefer them unless you want full control over what is going on behind the scenes. Additionally, not all data structures are created equal. Generally speaking, array operations are faster than map operations, whereas maps are more versatile than arrays!
- Learning Python Web Penetration Testing
- AngularJS Testing Cookbook
- Beginning C++ Game Programming
- Oracle從新手到高手
- Java面向對象思想與程序設計
- C語言程序設計基礎與實驗指導
- Java 9 Programming Blueprints
- PyTorch自然語言處理入門與實戰
- Production Ready OpenStack:Recipes for Successful Environments
- Scratch真好玩:教小孩學編程
- Reactive Android Programming
- Access 2010中文版項目教程
- Getting Started with Nano Server
- Julia High Performance(Second Edition)
- Visual Basic程序設計基礎