Today was dedicated towards another rabbit hole of the big o notation. I knew learning about code, that I had to look into computer science so I watched a crash course series about it from a YouTube. What better channel than one called Crash Course. I do remember big O being mentioned but not explained to well.
Big O notation is used to communicate how fast an algorithm is. This is important to know in regards to data structures and will help you be able to identify algorithms that may be congesting the code. This is a graph showing algorithm speeds.
I will not be going into depth of how these algorithm were made but rather which ones are the most useful. These are the common ones that you’ll run into.
- O(log n), also known as log time. Example: Binary search.
- O(n), also known as linear time. Example: Simple search.
- O(n * log n). Example: A fast sorting algorithm, like quick-sort.
- O(n2). Example: A slow sorting algorithm, like selection sort.
- O(n!). Example: A really slow algorithm.