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

    Joined:
    Jul 2, 2007
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    software engineer
    Location:
    Bangalore
    Merging of two arrays and sort it wthout using third array?
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,276
    Likes Received:
    364
    Trophy Points:
    83
    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

    Joined:
    Jul 2, 2007
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    software engineer
    Location:
    Bangalore
    I dont know how to do,Plz give program and explanation.
     
  4. sekhar_529

    sekhar_529 New Member

    Joined:
    Jul 2, 2007
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    software engineer
    Location:
    Bangalore
    I want someone to complete the job.
     
  5. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,276
    Likes Received:
    364
    Trophy Points:
    83
    Try the jobs forum then.
     
  6. ahmmad

    ahmmad New Member

    Joined:
    Aug 4, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    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

    Joined:
    Nov 24, 2009
    Messages:
    387
    Likes Received:
    90
    Trophy Points:
    0
    and the programming language is......:confused:
     
  8. virxen

    virxen New Member

    Joined:
    Nov 24, 2009
    Messages:
    387
    Likes Received:
    90
    Trophy Points:
    0
    Re: Merging of two arrays by Ahmmad


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

Share This Page