- 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
- What's New in TensorFlow 2.0
- Python自動化運維快速入門(第2版)
- Apache Hive Essentials
- 面向STEM的Scratch創(chuàng)新課程
- Java EE 7 Development with NetBeans 8
- 3D少兒游戲編程(原書第2版)
- 青少年Python編程入門
- Mastering Unity 2D Game Development(Second Edition)
- 利用Python進行數(shù)據(jù)分析
- ServiceNow:Building Powerful Workflows
- 分布式數(shù)據(jù)庫原理、架構與實踐
- .NET 4.0面向對象編程漫談:應用篇
- Java設計模式深入研究
- 3ds Max 2018從入門到精通