-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquestao_25.c
46 lines (36 loc) · 996 Bytes
/
questao_25.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
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#define TAM 6
#include "printVetor.h"
#include "bubbleSort.h"
#include "insertSort.h"
int main(){
clock_t p0, p1;
char vetor[TAM];
int i = 0;
printf("\nDigite as letras: \n");
while(i < TAM){
printf("\nLetra: ");
scanf("%c%*c", &vetor[i]);
i++;
}
printf("\n\n\tCADEIA DE CARACTERES NAO ORDENADA\n");
printVetor(vetor, TAM);
p0 = clock;
printf("\n\n\tCADEIA DE CARACTERES ORDENADA BUBBLE SORT\n");
bubbleSort(vetor, TAM);
printf("\nTempo -> %i segundos\n", (double)(p1-p0)/CLOCKS_PER_SEC);
printf("\nOrdenado: ");
printVetor(vetor, TAM);
p1= clock;
printf("\n\n\tCADEIA DE CARACTERES NAO ORDENADA\n");
printVetor(vetor, TAM);
p0 = clock;
printf("\n\n\tCADEIA DE CARACTERES ORDENADA INSERT SORT\n");
insertSort(vetor, TAM);
printf("\nTempo -> %i segundos\n", (double)(p1-p0)/CLOCKS_PER_SEC);
printf("\nOrdenado: ");
printVetor(vetor, TAM);
p1 = clock;
}