Merging of two arrays

Light Poster
10Jul2007,11:45   #1
sekhar_529's Avatar
Merging of two arrays and sort it wthout using third array?
Go4Expert Founder
10Jul2007,12:01   #2
shabbir's Avatar
Quote:
Originally Posted by sekhar_529
Merging of two arrays and sort it wthout using third array?
Did you start on the topic or want someone to complete the job and deliver it into your inbox.
Light Poster
10Jul2007,15:55   #3
sekhar_529's Avatar
I dont know how to do,Plz give program and explanation.
Light Poster
23Nov2007,15:28   #4
sekhar_529's Avatar
I want someone to complete the job.
Go4Expert Founder
23Nov2007,17:37   #5
shabbir's Avatar
Quote:
Originally Posted by sekhar_529
I want someone to complete the job.
Try the jobs forum then.
Newbie Member
4Aug2010,10:55   #6
ahmmad's Avatar
Quote:
Originally Posted by sekhar_529 View Post
Merging of two arrays and sort it wthout using third array?
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
virxen's Avatar
Quote:
Originally Posted by sekhar_529 View Post
Merging of two arrays and sort it wthout using third array?
and the programming language is......
Pro contributor
7Aug2010,02:24   #8
virxen's Avatar
Quote:
Originally Posted by ahmmad View Post
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]);
        }

    }
}

you used 3 arrays.The question was without a third array