Big-O Notation Why ? How ? To estimate the efficiency of an algorithm, the programmer has to be able to estimate the number of operations if requires to be executed. Usually the number of operations is estimated as a function of a parameter (like the number of data to work on, or the expected precision of a computation, etc.) For example : for(i = 0; i < n; i++) { ... } has a cost proportional to n. for(i = 1; i < n; i = i*2) { ... } has a cost proportional to log2 n for(i = 0; i < n; i++) for(j = 0; j<n*n; j++) { ... } has a cost proportional to n3.
Learn C++ Programming fast and easy, find C++ Program Codes