Merge Two Sorted Arrays | C Programming Example

preview_player
Показать описание
Рекомендации по теме
Комментарии
Автор

Want to see a *recursive* solution?

PortfolioCourses
Автор

6:48 shouldn't it be b[ j ] instead of b[ i ] ?

xkisix
Автор

Hi is it possible to make this with for loops instead of while loops?
Or does it work only with while loops

SketchupGuru
Автор

what happens if element in array A and array B are both equal? The else statement just assume that is never the case. This will break on special cases like these wouldn't it?

ClamChowderSoup
Автор

hi, is it possible to merge the two arrays first and then sort them using bubble sort?
I was trying this out int ar3[] = array1[]+array2[];
but it didn't work.
I'm sure this is possible in python. Any thoughts on this?

SketchupGuru
Автор

Tried the same code here, but these two arrays kept printing the way they inisialised. Can't end up merging like the wsy it's supposed to.

stone
Автор

Can’t you just write the while loop with || (or) instead of && (and), and avoid the other while loops?

syronox
Автор

thank u so much...can u do more videos about arrays and string algoritms

ionguzun
Автор

Heyy, which is this software? I have tried many sites to download the C software in macbook but it was unsuccessful

harisankar
Автор

What's the apps name that you use?

masumz
Автор

Nice : 🙃
// return the merged array
int *merge(int *array1, int m, int *array2, int n){
int *merged =
int i = 0, j = 0, k = 0;
while(i < m && j < n){
if(array1[i] < array2[j]){
merged[k++] = array1[i++];
}
else {
merged[k++] = array2[j++];
}
}
while(i < m){
merged[k++] = array1[i++];
}
while(j < n){
merged[k++] = array2[j++];
}
return merged;
}

justcurious
Автор

arr[]= {2, 4, 6, 8}
Arr[]={1, 3, 4, 5}
This type of example not fixed in this code

gouravchalotravlog