What is Big O Notation
Speed of an algorithm is affected by the size of the input. As the size of the input increases, the [[Time Complexity]] increases.
a = [...] N = 10000 000
B₁ => 1 + a[o] : time complexity: constant time, size of input (n) increases, the speed remains constant. hard to achieve, O(1)
B₂ => sum(a): time complexity: linear time, iterations through the array (a) in the sum function as there are elements in the array (N), O(N)
B₃ => pair(a): time complexity:
Change of speed of an algorithm is a mathematical concept called [[Asymptotic Analysis]].
Have anything to add? You can reach out to me by email or You can find more of my stuff on my links page.