1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

Merging of two arrays

Discussion in 'Programming' started by sekhar_529, Jul 10, 2007.

  1. sekhar_529

    sekhar_529 New Member

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

    shabbir Administrator Staff Member

    Did you start on the topic or want someone to complete the job and deliver it into your inbox.
     
  3. sekhar_529

    sekhar_529 New Member

    I dont know how to do,Plz give program and explanation.
     
  4. sekhar_529

    sekhar_529 New Member

    I want someone to complete the job.
     
  5. shabbir

    shabbir Administrator Staff Member

    Try the jobs forum then.
     
  6. ahmmad

    ahmmad New Member

    Re: Merging of two arrays by Ahmmad

    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 a moderator: Aug 4, 2010
  7. virxen

    virxen New Member

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

    virxen New Member

    Re: Merging of two arrays by Ahmmad


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

Share This Page