Introducing Big O notation
Big O notation is a good way to approximate the speed in which the algorithm you've chosen will change with the size of the data that's passed to your algorithm. Big O notation is often described as the growth behavior of a function, specifically its upper limit. Big O notation is broken down into classes. The most common classes that are described are O(1), O(log n), O(n), O(n log n), O(n2), and O(2n). Let's take a quick look at each of these algorithms, their definitions, and a practical example of them in Go.
A graph of these common classes is as follows. The source code for generating this plot can be found at https://github.com/bobstrecansky/HighPerformanceWithGo/blob/master/2-data-structures-and-algorithms/plot/plot.go ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access