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 the difference between ref and out in c#?
What is immutable in C#?
Explain About Virtual functions and their use.
How Global.asax is used ?
What does namespace mean?
What is the difference between namespace and class in c#?
What is Implementation inheritance
Difference between call by value and call by reference in C#?
Why do we use 0?
What are predicates in c#?
Why can't we use a static class instead of singleton?
How do you create partial methods?
What are Memory foot print of an exe?
What is base class in c#?
Can you describe iuknown interface in short?