Advertisement
Guest User

Untitled

a guest
Feb 11th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. clock_t start;
  2. vector<float> times;
  3. for(int i = 0; i<100; i++ ){
  4. vector<float> nums = {};
  5. nums.clear();
  6. for(int n = 0; n < size; n ++){
  7. nums.push_back((static_cast <float> (rand()) / static_cast <float> (RAND_MAX))*100);
  8. }
  9. start = clock();
  10. qk = quickSort(nums, 0, nums.size());
  11. times.push_back(clock() - start);
  12. }
  13. float totalTime = 0;
  14. for (float time : times) {
  15. totalTime += time;
  16. }
  17.  
  18. totalTime = totalTime/times.size();
  19. return totalTime;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement