Skip to content

Commit

Permalink
Merge pull request #83 from Serajhub/main
Browse files Browse the repository at this point in the history
Create timesort algorithm
  • Loading branch information
mr-robot-2008 committed Oct 30, 2022
2 parents 22722ce + 03bbc3e commit fab8a18
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions timesort algorithm
@@ -0,0 +1,20 @@
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char** argv) {
int max = 0;
for (int i = 1; i < argc; i++) {
int a= atoi(argv[i]);
if (a > max) {
max = a;
}
if (!fork()) {
usleep(a*1000);
printf("%d\n", a);
return 0;
}
}
usleep(max*1000+1000);
return 0;
};

0 comments on commit fab8a18

Please sign in to comment.