-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathalgorithms.implementation.c
More file actions
51 lines (41 loc) · 1.28 KB
/
Copy pathalgorithms.implementation.c
File metadata and controls
51 lines (41 loc) · 1.28 KB
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
#include <stdio.h>
#include <stdlib.h>
#include "./lib/bucket_sort.h"
#include "./lib/bubble_sort.h"
#include "./lib/uploadData.h"
int main() {
char famous_people[100][50];
int namesToOrderQtt;
int comparasion = 0, swap = 0, option;
uploadData(famous_people);
printf("Select the sorting algorithm:");
printf("\n[1] Bubble Sort");
printf("\n[2] Bucket Sort");
printf("\n> ");
scanf("%d", &option);
switch (option) {
case 1:
printf("> [BUBBLE SORT] Insira a quantidade de nomes para desordenar: ");
scanf("%d", &namesToOrderQtt);
bubbleSort(famous_people, namesToOrderQtt, &comparasion, &swap);
system("cls");
printf("BUBBLE SORT - ");
break;
case 2:
printf("> [BUCKET SORT] Insira a quantidade de nomes para desordenar: ");
scanf("%d", &namesToOrderQtt);
bucketSort(famous_people, namesToOrderQtt, &comparasion, &swap);
system("cls");
printf("BUCKET SORT - ");
break;
default:
break;
}
printf("Ordenando array de Z para A:\n\n");
for (int i = 0; i < namesToOrderQtt; i++) {
printf("%s\n", famous_people[i]);
}
printf("\n| Para %d nomes:", namesToOrderQtt);
printf("\n> Foram feitas %d comparacoes", comparasion);
printf("\n> Foram feitas %d trocas", swap);
}