Skip to content
Snippets Groups Projects
Commit d34821ed authored by SCHMIDT LUCAS's avatar SCHMIDT LUCAS
Browse files

Modification de tris pour qu'il utilise utils

parent 0a6a1be9
Branches
No related merge requests found
all: main triFusion triInsertion triRapide
main: main.c tris.o
main: main.c tris.o utils.o
gcc -Wall -o $@ $^
%.o: %.c
......
#include "tris.h"
void copierTableau(long* dest,long* src,size_t n){
for(size_t i = 0;i < n;i++){
dest[i] = src[i];
}
}
void fusion(long* A,size_t p,size_t q,size_t r){
size_t n1 = q-p;
size_t n2 = r-q;
......@@ -49,17 +43,6 @@ void triFusion(long* A,size_t n){
sousTriFusion(A,0,n);
}
void printTab(long* A,size_t n){
printf("{");
for(size_t i = 0;i < n;i++){
if(i != 0){
printf(",");
}
printf("%ld",A[i]);
}
printf("}\n");
}
void triInsertion(long* A, size_t n){
for(size_t i = 1; i < n; i ++){
long cle = A[i];
......@@ -72,12 +55,6 @@ void triInsertion(long* A, size_t n){
}
}
void permuter(long* a,long* b){
long tmp = *a;
*a = *b;
*b = tmp;
}
size_t partition(long* A,size_t p,size_t r){
long pivot = A[r-1];
size_t i = p;
......
#include <stdio.h>
#include <stdlib.h>
void copierTableau(long* dest,long* src,size_t n);
#include "utils.h"
void fusion(long* A,size_t p,size_t q,size_t r);
......@@ -9,12 +9,8 @@ void sousTriFusion(long* A,size_t p,size_t r);
void triFusion(long* A,size_t n);
void printTab(long* A,size_t n);
void triInsertion(long* A, size_t n);
void permuter(long* a,long* b);
size_t partition(long* A,size_t p,size_t r);
void sousTriRapide(long* A,size_t p,size_t r);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment