Skip to content
Snippets Groups Projects
Forked from GOSSA JULIEN / P4z
4 commits behind, 29 commits ahead of the upstream repository.
tri_insertion.c 339 B
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include "tri_insertion.h"

void triInsertion(long* A, size_t n) {
    for(size_t i = 1; i <= n-1; i++){
        long cle = A[i];
        size_t j = i - 1;
        while(j+1 >= j && A[j] > cle){
            A[j+1] = A[j];
            j = j-1;
        }
        A[j+1] = cle;
    }
}