This post provides a comprehensive explanation of Big O Notation, which is used to classify algorithms based on their time and space complexity as the input size grows. Examples for different time complexities like O(n), O(1), O(n^2), O(n*m), O(log n), O(n log n), O(2^n), and O(n!) are provided with detailed algorithms and coding snippets. The goal is to help readers understand and recall these concepts for coding interviews.

11m read timeFrom dev.to
Post cover image
Table of contents
IntroductionWhat is Big O time complexity?O(n) - Sure, give me an exampleO(1) - First and only exceptionO(n^2) - This seems easy enoughO(n*m) - Okay, now you're just adding lettersO(log n) - What?O(n log n) - Now you're just making stuff upO(2^n) - I should have seen it comingO(n!) - Make it end, please!So there you have it!
5 Comments

Sort: