Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void merge(int * left,int * right, int * a,int nr,int nl){
- int il=0,ir=0, i=0;
- while (il + ir < nl+nr){
- if(il==nl){
- a[i++]= left[++];
- continue;
- }
- if(ir==nr){
- a[i++]= right[++];
- continue;
- }
- if(left[il]>right[ir]){
- a[i++]=right[i++];
- }
- else{
- a[i++]=left[i++];
- }
- }
- }
- int main(){
- cout << a << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement