“Clearly specified set of simple instructions to be followed to solve a problem”
De looptijd van deze for-lus is orde-n, of kort: O(n) (= Big Oh notatie)
(int i = 0; i < n; i++)
(int i = 0; i < n*n; i++)
(int i = 0; i < 0.5 * n; i++)
O(N)
| x | Big Oh | |:———–|:——-| | x² | O(n²) | | x | O(n) | | x²+x | O(n²) | | x²-x | O(n²) | | (x^3/(x-1)) | O(n²) |
square of cubic root van (<doel-ms> / <ms voor 1 input>)x^(1/3) == cubic root| Fragment | Big-Oh | | ——– | ——– | | 1 | O(n) | | 2 | O(n) | | 3 | O(n²) | | 4 | O(n) | | 5 | O(n^3) | | 6 | O(n²) | | 7 | O(n^5) | | 8 | O(log n) |