Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

There are two sorted arrays
a1 and a2 of size n1 and size n2 respectively.
array a1 is full
array a2 has exactly n1(size of array a1) empty space.
example
a1[]=1234
a2[]=56789_ _ _ _
Write a function to merge these two arrays to form a sorted
array without any extra memory use.

i want a solution in c/c++ language

Answer Posted / surjeet gangwar

import java.util.*;
class arrtest
{
int[][] a=new int[3][3];
int[][] b={{1,1,1},{1,1,1},{1,1,1}};

public arrtest()
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter the matrix:\n");
for(int i=0;i<3;i++)
for(int j=0;j<3;j++)
a[i][j]=sc.nextInt();
}

void oper()
{
for(int i=0;i<3;i++)
for(int j=0;j<3;j++)
if(a[i][j]==0)
for(int k=0;k<3;k++)
{
b[i][k]=0;
b[k][j]=0;
}
}

void print()
{
System.out.println(" the matrix:\n");
for(int i=0;i<3;i++)
{ for(int j=0;j<3;j++)
System.out.print("\t"+b[i][j]);

System.out.println("\n");
}
}
}
class arrdemo
{
public static void main(String a[])
{
arrtest at=new arrtest();
at.oper();
at.print();
}
}

Is This Answer Correct ?    0 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

in a railway station, there are tow trains going. One in the harbour line and one in the main line, each having a frequency of 10 minutes. the main line service starts at 5 o'clock. the harbour line starts at 5.02a.m. a man goes to the station every day to catch the first train. what is the probability of man catchinhg the first train

1161


3/p=6, 3/q=15 ......find p-q

1286


If 15 pens costs Rs.90..then what will be the cost of 22pens?

1654


Complete the sequence A, E ,I ,M ,Q ,U , _ , _?

1152


a, b, b, c, c, c, d, d, d, d, . . . . . . Find the 288th letter of this series?

1652


There are 150 weights .Some are 1 kg weights and some are 2 kg weights. The sum of the weights is 260.is the number of 1kg weights?

1444


a grandfather has 5 sons and daughters and grandchildren.they have to be arranged in a row such that the first 4 seats and last four seats are to be taken by grandchildren and the grandfather would not sit adjacent to any of the grandchildren.

2925


Light glows for every 13 seconds . How many times did it glow between 1:57:58 and 3:20:47 am.

2211


the matrix of a(7,9) was given.the address of the first byte of a(1,1)=1258.it takes 4 bytes to store the nuymber. then calculate the address of the last byte of a(5,8)

1264


If 12 box containers require 18 feet of wall space, how many feet of wall space will 30 box containers require?

1691


If the equation x2 - 3x + a = 0 has the roots (0,1) then value of a is ?

1158


There are 19 red balls and one black ball . Ten balls are put in one jar and the remaining 10 are put in another jar. what is the possibility that the black is in the right jar.

1378


15 Men take 21 days of 8 hrs. each to do a piece of work. How many days of 6 hrs. each would do if 21 women take. If 3 women do as much work of 2 men.

1243


In 1978, a kg of paper was sold at Rs25/. If the paper rate increases at 1.5% more than the inflation rate which is 6.5% a year, then what will be the cost of a kg of paper after 2 years?

1166


hi...i have got selected for United bank po interview.can anyboby suggest me how to prepare for interview.r there any books for po interview?i am asking because..this s my 1 st bank interview...pls send me interview material if u have any ..my mail id=pruthi_tarun@yahoo.co.in....thank u

2781