Merging of two arrays
|
Light Poster
|
|
| 10Jul2007,11:45 | #1 |
|
Merging of two arrays and sort it wthout using third array?
|
|
Go4Expert Founder
|
![]() |
| 10Jul2007,12:01 | #2 |
|
Quote:
Originally Posted by sekhar_529 |
|
Light Poster
|
|
| 10Jul2007,15:55 | #3 |
|
I dont know how to do,Plz give program and explanation.
|
|
Light Poster
|
|
| 23Nov2007,15:28 | #4 |
|
I want someone to complete the job.
|
|
Go4Expert Founder
|
![]() |
| 23Nov2007,17:37 | #5 |
|
Quote:
Originally Posted by sekhar_529 |
|
Newbie Member
|
|
| 4Aug2010,10:55 | #6 |
|
Code:
public class Merge3
{
public static void main(String[] args)
{
int[]A = {1,2};
int[]B = {7,8,9};
int[]C = new int[A.length + B.length];
int a = 0;
int aCount = A.length;
int bCount=B.length;
int c = C.length;
while (a < aCount)
{
if(A[a] < B[a])
C[a]= A[a];
else
C[a]=B[a];
a++;
}
for(int b1 = 0; b1 < B.length; b1++){
C[a] = B[b1];
a++;
}
for (int i = 0; i < C.length; i++){
System.out.println(C[i]);
}
}
}
Last edited by shabbir; 4Aug2010 at 11:43.. Reason: Code Block |
|
Pro contributor
|
![]() |
| 7Aug2010,02:22 | #7 |
|
Pro contributor
|
![]() |
| 7Aug2010,02:24 | #8 |
|
Quote:
Originally Posted by ahmmad you used 3 arrays.The question was without a third array |



