Search
 
SCRIPT & CODE EXAMPLE
 

CPP

c++ merging algorithm

int n,a[100000], m , b[100000], p, c[200000];

//citire a[] cu n elemente
//citire b[] cu m elemente

int i = 0 , j = 0;
p = 0;
while(i < n && j < m)
    if(a[i] < b[j])
        c[p ++] = a[i ++];
    else
        c[p ++] = b[j ++];
while(i < n)
    c[p ++] = a[i ++];
while(j < m)
    c[p ++] = b[j ++];
Comment

PREVIOUS NEXT
Code Example
Cpp :: numpy array scalar addition 
Cpp :: flutter container margin 
Cpp :: fsafdsfdsaf 
Cpp :: float to byte array and back c++ with memcpy command 
Cpp :: GCD(x, yz) 
Cpp :: how to find the left most bit 1 in binary of any number 
Cpp :: crtdbg c++ 
Cpp :: escribir texto c++ 
Cpp :: xor linked list 
Cpp :: convert c program to c++ online 
Cpp :: Boats to Save People leetcode solution in c++ 
Cpp :: how to insert variable into string c++ 
Cpp :: break input stream into words 
Cpp :: c++ rgb code 
Cpp :: bash script add another user 
Cpp :: c++ how to iterate through 2d array in c++ 
Cpp :: Define and show the implementation of the functions of an arrayList. 
Cpp :: is plaindrome 
Cpp :: compile c++ program 
Cpp :: subsets of a given array 
Cpp :: unity decompile il2cpp 
Cpp :: Configuring an c++ OpenCV project with Cmake 
Cpp :: rand function c++ 
Cpp :: error when using template base class members 
Cpp :: int a=0; int b=30; 
Cpp :: double pointers C++ 
Cpp :: c++ set element at index 
Cpp :: what is push() c++ 
Cpp :: c++ handling 
Cpp :: why ostream cannot be constant 
ADD CONTENT
Topic
Content
Source link
Name
6+1 =