while (i<r && j<u) {
if (a[i]<=a[j]) {
b[k]=a[i];
i++;
}
else {
b[k]=a[j];
j++;
}
k++;
}
In the above C++ code values of two arrays is checked and value of one array is assigned to another array when the depending upon the condition satisfies.
am beginner programmer in python.There is something called list in python similar to array in c++. how the above code can be implemented in python?
list(sorted(a)). but if you insist on implementing merge, use can drop thekvariable and useb.append(min(a[i], a[j]))instead.