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
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / m.shanmuga sundaram,rjnsoftwar
There is no requirement to do this in C#. If you ask this
for in C or C++, I can write for you or we can find umpteen
number of examples in internet.But C# has the built in,time
tested functions with proper error handling. Thanks.
Is This Answer Correct ? | 2 Yes | 0 No |
What is wrong with the sample program below?
what is uniary operators and binary operators and what is the difference
Is goto statement supported in C#? How about Java?
What are value types in c#?
What is class sortedlist underneath?
What is the use of constructor in c# with example?
What is difference between throw and throws in c#?
How can it prevents DLL Hell assembly versioning in .NET?
what is the fastest way to concatenate strings in c sharp?
What is uint c#?
What's the difference between System.String and System..StringBuilder in C#?
Is string nullable c#?