fork(1) download
  1. #ifndef HEADER_H
  2.  
  3. #define _CRT_SECURE_NO_WARNINGS
  4.  
  5. #include <stdio.h>
  6. #include <stdlib.h>
  7. #include <time.h>
  8. #include <math.h>
  9.  
  10.  
  11. #define LIMIT 10000
  12.  
  13. int *Random(int *amount);
  14.  
  15. float ShellSort(int *amount);
  16.  
  17. float InsertionSort(int **result, int *amount);
  18.  
  19. #endif // HEADER_H
  20.  
  21. //#include "header.h"
  22.  
  23. float InsertionSort(int **result, int *amount)
  24. {
  25. clock_t start;
  26. int i, k, temp;
  27. static unsigned int operations;
  28.  
  29. start = clock();
  30.  
  31. for (i = 1; i < *amount; i++)
  32. {
  33. temp = *result[i];
  34. for (k = i - 1; k > -1; k--)
  35. {
  36. if (temp < *result[k])
  37. {
  38. *result[k + 1] = *result[k];
  39. operations++;
  40. }
  41. else
  42. break;
  43. }
  44. *result[++k] = temp;
  45. operations++;
  46.  
  47.  
  48. }
  49. start = clock() - start;
  50.  
  51.  
  52.  
  53.  
  54. return ((float)start) / CLOCKS_PER_SEC;
  55. }
  56.  
  57. int main()
  58. {
  59. return 0;
  60. }
Success #stdin #stdout 0s 3456KB
stdin
Standard input is empty
stdout
Standard output is empty