Advertisement
Guest User

Untitled

a guest
May 28th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.83 KB | None | 0 0
  1.  
  2. void test(int ile, char znak, int p, bool r, int t)
  3. {
  4.   clock_t start,stop;
  5.   double czas;
  6.   bool kom = true;
  7.   int **tab = new int * [ile];
  8.   for(int i=0; i<100; i++)  { tab[i] = new int [ile]; generowanie_tabeli(tab[i],ile,p,r);  }
  9.  
  10.   start = clock();
  11.   for(int i=0; i<100; i++)
  12.   {
  13.     if(znak == 's') MergeSort(0,ile-1,tab[i],ile);
  14.     if(znak == 'q') QuickSort(tab[i],0,ile-1);
  15.     if(znak == 'i') IntroSort(tab[i],ile);
  16.  
  17.     try { sprawdzenie(tab[i],ile);  }
  18.     catch(bool w) { kom = w;   }
  19.   }
  20.   stop = clock();
  21.   czas = (double)(stop-start) / CLOCKS_PER_SEC;
  22.   for(int i=0; i<100; i++) delete [] tab[i];
  23.   delete [] tab;
  24.  
  25.  
  26.  
  27.  
  28.  
  29.   cout << "Czas: " << setprecision(10) << czas << " s" << endl;
  30.   if(kom == true) cout << "sort sie udal" << endl;
  31.   else cout << "sort sie nie udal" << endl;
  32.   getchar();
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement