krot

Процедура слияния

Jan 26th, 2013
63
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. int in1=0,in2=0;
  2. while((in1+in2)<(c_a+c_b)){
  3.  if((in2>=c_b) or((in1<c_a) and a[in1]<=b[in2]))  {
  4.    out[in1+in2]=a[in1];
  5.     in1++;    
  6.  } else{
  7.         out[in1+in2]=b[in2];
  8.     in2++;  
  9.     }
  10. }
RAW Paste Data