Member-only story
Study Guide — Big O Notation In Software Engineering
1 min readDec 13, 2023
Breaking down algorithm’s like a champ.
First you should know the difference between each algorithm and the constraints each solution may have on solving a problem.
Constant Time O(1) — Excellent/Best Case Time Complexity
const constantTimeExample = array => array[0];
Linear Time O(n) — Fair Case Time Complexity
const linearTimeExample = array => array.forEach(element => console.log(element));
Quadratic Time O(n²) — Horrible Case Time Complexity
const quadraticTimeExample = array => array.forEach(i => array.forEach(j => console.log(i, j)));
Factorial Time O(n!) — Worst Case Time Complexity
const factorialTimeExample = n => (n === 0 || n === 1) ? 1 : n * factorialTimeExample(n - 1);
P.S. If you’re a fan of Medium as much as we are, consider supporting me and the thousands of other writers on Ko-Fi.
It only costs $8 for a coffee, and it supports us writers. Thank you, Greatly.