Before diving into the other common time complexities, I'm so happy I made my first contribution to open-source!
I decided to take part in this year's Hacktoberfest and frankly, I was a bit nervous in the beginning. I won't say my first code was life-changing but it has given me the courage to tackle some more difficult problems before the end of the challenge.
Now over to Big O Notation
Today I'd like to discuss Quadratic "O on n squared" and Logarithmic "O of log n".
Quadratic Time Complexity
This time complexity is when the runtime scales quadratically with the input. As the input size increases, the runtime of the algorithm also increases in a quadratic fashion. So if the input size is 10, the runtime is 100 steps. If the input size is 100, the runtime is 10,000 steps. Some examples of this include:
Nested Loops - when nested loops both iterate over the same array or input
Bubble Sort
Insertion Sort
Brute Force Algorithms
Logarithmic Time Complexity
This time complexity is when the runtime grows logarithmically with the input size. As the input size increases, the runtime of the algorithm increases, but at a much slower rate compared to linear or quadratic time complexities. Some examples include:
Binary Search
Binary Tree Operations
Heap Operations
Graph Algorithms
I haven't gotten this far in my course to talk in-depth about these different problems. Once I across these I will be sure recap on how these different complexities are used within these DSA problems.