Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Programming (http://www.go4expert.com/forums/programming-forum/)
-   -   Merging of two arrays (http://www.go4expert.com/forums/merging-arrays-t5175/)

sekhar_529 10Jul2007 11:45

Merging of two arrays
 
Merging of two arrays and sort it wthout using third array?

shabbir 10Jul2007 12:01

Re: Merging of two arrays
 
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.

sekhar_529 10Jul2007 15:55

Re: Merging of two arrays
 
I dont know how to do,Plz give program and explanation.

sekhar_529 23Nov2007 15:28

Re: Merging of two arrays
 
I want someone to complete the job.

shabbir 23Nov2007 17:37

Re: Merging of two arrays
 
Quote:

Originally Posted by sekhar_529
I want someone to complete the job.

Try the jobs forum then.

ahmmad 4Aug2010 10:55

Re: Merging of two arrays by Ahmmad
 
Quote:

Originally Posted by sekhar_529 (Post 14554)
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]);
        }

    }
}


virxen 7Aug2010 02:22

Re: Merging of two arrays
 
Quote:

Originally Posted by sekhar_529 (Post 14554)
Merging of two arrays and sort it wthout using third array?

and the programming language is......:confused:

virxen 7Aug2010 02:24

Re: Merging of two arrays by Ahmmad
 
Quote:

Originally Posted by ahmmad (Post 71155)
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


All times are GMT +5.5. The time now is 17:25.