I was given the following HomeWork assignment,
Write a program to test on your computer how long it takes to do nlogn, n2, n5, 2n, and n! additions
better than time() with second-precision is to use a milliseconds precision. a portable way is e.g.
int main(){ clock_t start, end; double msecs; start = clock(); /* any stuff here ... */ end = clock(); msecs = ((double) (end - start)) * 1000 / CLOCKS_PER_SEC; return 0; }