Advertisement
Guest User

Untitled

a guest
Apr 21st, 2015
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1.  
  2. int dosort(int N)
  3. {
  4. vector<double> data(N);
  5. for(unsigned int i=0; i<N; i++) {
  6. data[i] = rand()/(RAND_MAX+1.0);
  7. }
  8. sort(data.begin(), data.end());
  9. }
  10.  
  11.  
  12. int main(int argc, char *argv[])
  13. {
  14. int times[7] = {10, 100, 10000, 10000, 1000000, 10000000};
  15. for(int i=0;i<7;i++)
  16. {
  17. clock_t start = clock();
  18. dosort(times[i]);
  19. clock_t end = clock();
  20. cout << ((double)(end-start))/CLOCKS_PER_SEC
  21. << "\n";
  22. }
  23. cout << "Done\n";
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement