Chapter 12. Algorithm Complexity
In this chapter, we will to cover the famous big-O notation (introduced in Chapter 10 , Sorting and Searching Algorithms) and the NP-Completeness theory and also take a look at how we can have some fun with algorithms and boost our knowledge to improve our programming and problem-solving skills.
Big-O notation
In Chapter 10 , Sorting and Searching Algorithms, we introduced the concept of big-O notation. What does this mean exactly? It is used to describe the performance or complexity of an algorithm.
When analyzing algorithms, the following classes of functions are the most commonly encountered:
Notation |
Name |
O(1) |
Constant |
O(log(n)) |
Logarithmic |
O((log(n))c) |
Poly-logarithmic |
O(n) |
Linear ... |
Get Learning JavaScript Data Structures and Algorithms - Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.