Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include "SortFunctions.h"
- //void fillArray(int s, int pInt[s], int mer[s]);
- using namespace std;
- int main() {
- srand((unsigned)time(0));
- int selTemp = 0;
- int mergTemp = 0;
- int worseCaseSelection[10000];
- int worseCaseMerge[10000];
- for(int ARR_SIZE = 2; ARR_SIZE <= 100; ARR_SIZE++){
- int mer[ARR_SIZE];
- int sel[ARR_SIZE];
- for(int i = 0; i < 10000; i++) {
- fillArray(ARR_SIZE, sel, mer);
- worseCaseMerge[i] = mergeSort(mer, 0 , ARR_SIZE-1, 0);
- worseCaseSelection[i] = selectionSort(sel, ARR_SIZE);
- }
- for(int i=0;i<10000;i++)
- {
- if(worseCaseSelection[i]>selTemp){
- selTemp=worseCaseSelection[i];
- }
- if(worseCaseMerge[i]>mergTemp){
- mergTemp=worseCaseMerge[i];
- }
- }
- cout << ARR_SIZE << "," << selTemp << "," << mergTemp << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement