BIG-O

Sejan Miah
killingMeSwiftly
Published in
1 min readJul 17, 2017

Big-O Notation: to put it simply, Big-O Notation measures the efficiency of an algorithm as it scales.

Time Complexity: also known as asymptotic notation/Big-O runtime.

O(1) à You’re sending data on an airplane and the amount of time it will take is constant, regardless of data-size.

O(s) à As the size of your data increases, it’s run-time increases in a linear relationship to the data.

Linear will at some point over take the constant, even if the constant is quite large. (Think about positive slopes!)

The function arrayOfItems runs in O(1) time (“constant time”) relative to its input because no matter how large the array is we are simply printing out the first element in the array. So size variaations aside we are simply performing one task, printing the first item, hence it is O(1).

--

--