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
What is thread pooling?
What is the difference between abstract and virtual?
What are extensions in c#?
What is the use of nullable types in c#?
What are the advantages of using c#?
What is a collection class in c#?
Can we create instance of private class in c#?
Why reflection is used in c#?
Is and as in c#?
How can you read 3rd line from a text file?
What are data types examples?
Is namespace necessary in c#?
Is null in c#?
What are the Types of configuration files and their differences
Why to use “finally” block in c#?