-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
77 lines (60 loc) · 1.63 KB
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#include <stdio.h>
#include "libsort.h"
#include <stdlib.h>
#include <time.h>
int main()
{
int choice =7;
time_t t;
int size=120;
int list[size];
printf("******************************************************\n");
printf("***************** SORTING ALGORITHM ******************\n");
printf("******************************************************\n");
printf("\n");
printf("Hello Yehuda\n\n");
srand((unsigned) time(&t));
// int size = sizeof(list)/sizeof(list[0]);
int i=0;
while( i < size){
list[i] = (int) (rand() % 5550);
i++;
}
printf("Initial array :\n");
printArray(list, size);
printf("1. Bubble Sort\n");
printf("2. Insertion Sort\n");
printf("3. Selection Sort\n");
printf("4. Merge Sort\n");
printf("5. Quick Sort\n");
while(choice > 5)
{
scanf("%d", &choice);
switch(choice)
{
case 1:
bubbleSort(list, size);
break;
case 2:
selectionSort(list, size);
break;
case 3:
insertionSort(list, size);
break;
case 4:
printf("Not implemented\n");
return 0;
break;
case 5:
printf("Not implemented\n");
return 0;
break;
default:
printf("Select a correct choice\n");
break;
}
}
printf("\nSorted array :\n");
printArray(list, size);
return 0;
}