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
Is c# code is unmanaged or managed code?
Why extension method is static?
What is the difference between internal and private in c#?
Why is it efficient to use System.string under System.Text.StringBuilder ?
What is the difference between virtual method and abstract method?
Explain what a diffgram, and a good use for one Define diffgram? How it be used?
Explain clr in brief.
What is indexer c#?
What is poco c#?
Explain the difference between class and interface in .net?
What are fields in c#?
What is deferred execution?
What is the usage of transponders?
How is exception handling implemented in c#?
Can enum be null c#?