What is Big-O?

Simplified analysis of an algorithm's efficiency.

Screen Shot 2022-03-16 at 19.36.21.png

O(1) < O(log n) < O(n) < O(n log n) < O(nˆ2) < O(2ˆn) < O(n!)

Types of measurement

<aside> 💡 In an If statement, we're going to always considerate the worst-case path.

</aside>

Concepts

There are 3 common cases: linear time, constant time and quadratic time. They behavior like their respective functions, when we plot a chart with some examples. Like below:

Screen Shot 2022-03-16 at 19.48.27.png

Examples

Example 1:

x = 5 + (15 * 20);