Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void mischen(int m,double a[], int n, double b[], double c[]){ //a[m] b[n],c[]
- int cIndex = m+n+1; // Index des Array C //Plus eins da die größe des neuen Arrays =
- if(n<0)
- {
- copy(m,0,a,c); // Wenn B leer ist rest von a in c kopieren
- }
- else if(m<0)
- {
- copy(n,0,b,c); // Wenn A leer ist rest von b in c kopieren
- }
- else if(a[m]>= b[n])
- {
- c[cIndex] = a[m];
- //cout<<c[cIndex]<<" n="<<n<<" m="<<m<<" Index="<<cIndex<<endl;
- m--;
- mischen(m,a,n,b,c);
- }
- else if(a[m]<= b[n])
- {
- c[cIndex] = b[n];
- //cout<<c[cIndex]<<" n="<<n<<" m="<<m<<" Index="<<cIndex<<endl;
- n--;
- mischen(m,a,n,b,c);
- }
- }
Add Comment
Please, Sign In to add comment