Big O
Big O notation is a way of describing the performance of a function without using time. Rather than timing a function from start to finish, big O describes how the time grows as the input size increases. It is used to help understand how programs will perform across a range of inputs. In this post I'm going to cover 4 frequently-used categories of big O notation: constant, logarithmic, linear, and quadratic. Don't worry if these words mean nothing to you right now. I'm going to talk about them in detail, as well as visualise them, throughout this post. Before you scroll! This post has been sponsored by the wonderful folks at ittybit, and their API for working with videos, images, and audio. If you need to store, encode, or get intelligence from the media files in your app, check them out! Consider this JavaScript function that calculates the sum of 1 to n. I'm going to pass in 1 billion, written using the shorthand 1e9, so it takes a noticeable amount of time to run. Press the button
Big O notation is a way of describing the performance of a function without using time. Rather than timing a function from start to finish, big O describes how the time grows as the input size increases. It is used to help understand how programs will perform across a range of inputs. In this post I'm going to cover 4 frequently-used categories of big O notation: constant , logarithmic , linear , and quadratic . Don't worry if these words mean nothing to you right now. I'm going to talk about them in detail, as well as visualise them, throughout this post. Before you scroll! This post has been
saved by
related reading
- Big O Cheat Sheet – Time Complexity Chartfreecodecamp.org
- But what is a convolution?youtube.com
- Big-O Algorithm Complexity Cheat Sheet (Know Thy Complexities!) @ericdrowellbigocheatsheet.com
- Big O notation - Wikipediaen.wikipedia.org
- Complexity class - Wikipediaen.wikipedia.org
- Memory access is O(N^[1/3])vitalik.eth.limo
- Time complexity of operations on built-in typesdocs.python.org
- Quantization from the ground upngrok.com
- CRDTs go brrrjosephg.com
- Binary Exponentiation - Algorithms for Competitive Programmingcp-algorithms.com
- Y: The Most Beautiful Idea in Computer Science explained in JavaScriptlucasfcosta.com
- Everything Is Logarithmsalexkritchevsky.com