+ 2
Big-O refers to the complexity of the algorithm in time. O(n) means that the algorithm will take on the order of n operations to complete its purpose. For instance, if you want to find an element in an unsorted array of n elements, your algorithm will need in the worst case n iterations (in case the element is the last one) for (int i=0;i<array.size();i++){ if (array[i]==x){ print("I found it"); break; } } //n=array.size()
2nd Mar 2019, 12:21 AM
Themelina Kouzoumpasi
Themelina Kouzoumpasi - avatar