Advertisement
valenki13

lesson_151123

Nov 15th, 2023
746
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.65 KB | None | 0 0
  1. #include <iostream>
  2. #include "my_lib.h"
  3.  
  4. #include <chrono>
  5.  
  6. // pastebin.com/WCDKQ7Fd
  7. using namespace std;
  8.  
  9.  
  10.  
  11. void test_sort() {
  12.     srand(time(NULL));
  13.    
  14.     int a[100000];
  15.     for (int k = 0; k < size(a); k++) {
  16.         a[k] = rand() % 10000;
  17.     }
  18.     int sz = (int)size(a);
  19.     cout << "Before: ";
  20.     //show_arr(sz, a);
  21.    
  22.     auto start_time = std::chrono::high_resolution_clock::now();
  23.  
  24.     isert_sort(sz, a);
  25.  
  26.     auto end_time = std::chrono::high_resolution_clock::now();
  27.     std::chrono::duration<double> time = end_time - start_time;
  28.     cout << time.count() << " s to run.\n";
  29.  
  30.  
  31.     cout << "After : ";
  32.     //show_arr(sz, a);
  33. }
  34.  
  35. int main() {
  36.     test_sort();
  37.     return 0;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement