Ordina-vettori

Run Settings
LanguageC
Language Version
Run Command
//Ordina numeri in due vettori //sequenza ordinata di due vettori #include <stdio.h> void fusione (int v1[], int nv1, int v2[], int nv2, int v3[], int nv3); int main(){ int v1[4]={1,3,5,7}; int v2[5]={2,6,6,9,11}; int v3[9]={}; fusione(v1, 4, v2, 5, v3, 9); } void fusione (int v1[], int nv1, int v2[], int nv2, int v3[], int nv3){ int i,j; for (i=0,j=0;i<nv1 && j<nv2; ){ if(v1[i]<v2[j]){ v3[i+j]=v1[i]; i++; } else{ v3[i+j]=v1[j]; j++; } } return;}
Editor Settings
Theme
Key bindings
Full width
Lines