Advertisement
Guest User

Untitled

a guest
Dec 2nd, 2015
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. void merge(int * left,int * right, int * a,int nr,int nl){
  5. int il=0,ir=0, i=0;
  6. while (il + ir < nl+nr){
  7. if(il==nl){
  8. a[i++]= left[++];
  9. continue;
  10. }
  11. if(ir==nr){
  12. a[i++]= right[++];
  13. continue;
  14. }
  15.  
  16. if(left[il]>right[ir]){
  17. a[i++]=right[i++];
  18. }
  19. else{
  20. a[i++]=left[i++];
  21. }
  22. }
  23. }
  24.  
  25. int main(){
  26.  
  27. cout << a << endl;
  28. return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement