Pour la postérité:
Code java : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 void reorder(int[] m,int c,int l) { int n=l*c; // FIFO int[] fifo = new int[l]; int poshead=0, posqueue=0; for(int i=(c-1);i<n;i++) { fifo[posqueue]=m[i]; posqueue=(posqueue+1)%l; if ((i+1)%c==0) { m[i] = 0; } else { m[i] = fifo[poshead]; poshead=(poshead+1)%l; } } }
Partager