Advertisement
Guest User

main

a guest
Mar 19th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. #include <iostream>
  2. #include "SortFunctions.h"
  3.  
  4. //void fillArray(int s, int pInt[s], int mer[s]);
  5.  
  6. using namespace std;
  7. int main() {
  8. srand((unsigned)time(0));
  9. int selTemp = 0;
  10. int mergTemp = 0;
  11. int worseCaseSelection[10000];
  12. int worseCaseMerge[10000];
  13. for(int ARR_SIZE = 2; ARR_SIZE <= 100; ARR_SIZE++){
  14. int mer[ARR_SIZE];
  15. int sel[ARR_SIZE];
  16. for(int i = 0; i < 10000; i++) {
  17. fillArray(ARR_SIZE, sel, mer);
  18. worseCaseMerge[i] = mergeSort(mer, 0 , ARR_SIZE-1, 0);
  19. worseCaseSelection[i] = selectionSort(sel, ARR_SIZE);
  20.  
  21.  
  22. }
  23. for(int i=0;i<10000;i++)
  24. {
  25. if(worseCaseSelection[i]>selTemp){
  26. selTemp=worseCaseSelection[i];
  27. }
  28. if(worseCaseMerge[i]>mergTemp){
  29. mergTemp=worseCaseMerge[i];
  30. }
  31.  
  32. }
  33. cout << ARR_SIZE << "," << selTemp << "," << mergTemp << endl;
  34.  
  35. }
  36.  
  37.  
  38.  
  39.  
  40.  
  41. return 0;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement