Skip to the content.

Side 01 Reading Notes


Big-0 Notation in 100 Seconds

O(N)

The faster the result of each step the worse your algorithm will perform.

A loop over the array of elements will take the exact amount of time to loop over each element. This is known as the linear complexity. Because we have a one to one ratio between number of inputs and the amount of time it takes to execute the algorithm.

A sorting algorithm is a O(n), because it is searching for the index and moving the elements as requested.

When selecting an index within an array, it’s an O(1), because it is searching and returning the specified index, no matter how long or short that array is.

A loop within a loop is an Exponential complexity. The worse one, which is O(n^2).

Things I want to know more about

<—BACK