c# code for how to merge two sorted arrays
Input : A = 2,5,8,4
B = 3,9,10,5
Output : 2,3,4,5,5,8,9,10
Answer Posted / m.shanmuga sundaram, rjnsoftwa
int[] A = {2,5,8,4};
int[] B = { 3, 9, 10, 5 };
int[] C = new int[A.Length + B.Length];
A.CopyTo(C, 0);
B.CopyTo(C, A.Length);
Array.Sort(C);
foreach (int num in C)
{
Console.WriteLine(num);
}
| Is This Answer Correct ? | 8 Yes | 3 No |
Post New Answer View All Answers
Difference between debug.write and trace.write?
What does it mean to override a method?
How do you pronounce c#?
What is dll hell, and how does .net solve it?
What are some examples of desktop applications?
Is it possible to restrict the scope of a field/method of a class to the classes in the same namespace?
Which is the base class in c#?
What is a sealed class?
What are actions in c#?
What is asenumerable in c#?
if we are updating a database using thread, and mean while application crashes or thread being aborted then what will happen in Database? Rollback or Database will be updated? Please explain with different scenario.
What is c# used for?
List down the differences between public, static and void keywords?
What is stringreader in c#?
Are all methods virtual in c#?