Note: the running time will vary depending on the machine that you are using and how busy the CPU is. For both of these situations, you might get a runtime of zero. Of course, your runtime is not actually zero, but it might be a non-recordable length (smaller than milliseconds). You can slow down the run-time by including a "cout" statement into the original loop and changing n to smaller value such as 300 (otherwise, it will take too long).
This did happen. But I also expectedruntime_of_O(n²)_function
>runtime_of_O(n)_function
>runtime_of_O(1)_function
This didn't happen. However, you can say that a function "is big O n squared", but you can not say that a function "equals big O of n squared". O is not a mathematical function, therefore, most mathematical properties will not apply.runtime_of_O(n)_function
=sqrt(runtime_of_O(n²)_function)
; where, sqrt represents the square root
|
|
|