#include <stdio.h>
#include <conio.h>
void main(){
int a[10],b[10],c[10],i,j,m,n,tmp,k;
printf("\nEnter the size of the 1st array:");
scanf("%d",&m);
printf("\nEnter the size of the 2nd array:");
scanf("%d",&n);
printf("\nEnter the 1st array values:");
for(i=0;i<m;i++){
scanf("%d",&a[i]);
}
printf("\nEnter the 2nd array values:");
for(i=0;i<n;i++){
scanf("%d",&b[i]);
}
for(i=0;i<m;i++)
{
for(j=0;j<m-i;j++)
{
if(a[j]>a[j+1])
{
tmp=a[j];
a[j]=a[j+1];
a[j+1]=tmp;
}
}
}
printf("\n\n Array in the ascending order is - \n");
for(i=0;i<m;i++)
{
printf("\t %d",a[i]);
}
for(i=0;i<n;i++)
{
for(j=0;j<n-i;j++)
{
if(b[j]>b[j+1])
{
tmp=b[j];
b[j]=b[j+1];
b[j+1]=tmp;
}
}
}
printf("\n\n Array in the ascending order is - \n");
for(i=0;i<n;i++)
{
printf("\t %d",b[i]);
}
i=j=k=0;
while(i<n&&j<m)
{
if(a[i]<b[j])
c[k++]=a[i++];
else
if(a[i]>b[j])
c[k++]=b[j++];
else
{
c[k++]=b[j++];
i++;
j++;
}
}
if(i<n)
{
int t;
for(t=0;t<n;t++)
c[k++]=a[i++];
}
if(j<m)
{
int t;
for(t=0;t<m;t++)
{
c[k++]=b[j++];
}
}
printf("\nFinally sorted join array is:");
for(k=0;k<(m+n);k++)
printf("\t\n %d ",c[k]);
getch();
}
write a program to traverse a merge sort
You need to specify the language in which you want the subtraction of the two matrix in two dimension array written.
Take another array big enough to hold both array copy content of these two array into new one. You merged two array and haven't used a single function.!
maxValue = function (array) {mxm = array[0];for (i=0; i<array.length; i++) {if (array[i]>mxm) {mxm = array[i];}}return mxm;}; i don't know
In merge sort the whole is divided into two sub arrays. (This way of solving problem is called Divide and conquer algorithm) These sub arrays are called auxiliary arrays. First an array A is divided into two auxiliary arrays A1 and A2. Now these auxiliary arrays are further divided until we reach a stage with an auxiliary array of 2 elements. These 2 elements are arranged in incremental order and merged with the previous divided arrays. So we can say that auxiliary array is used to implement the basic principle of merge sort.
To determine if an array is symmetric, the array must be square. If so, check each element against its transpose. If all elements are equal, the array is symmetric.For a two-dimensional array (a matrix) of order n, the following code will determine if it is symmetric or not:templatebool symmetric(const std::array& matrix){for (size_t r=0 ; r
write a c program to circular queue
You need to specify the language in which you want the subtraction of the two matrix in two dimension array written.
Take another array big enough to hold both array copy content of these two array into new one. You merged two array and haven't used a single function.!
maxValue = function (array) {mxm = array[0];for (i=0; i<array.length; i++) {if (array[i]>mxm) {mxm = array[i];}}return mxm;}; i don't know
you can write by two ways 1 by giving the size of array at declaration 2 by checking condition
In merge sort the whole is divided into two sub arrays. (This way of solving problem is called Divide and conquer algorithm) These sub arrays are called auxiliary arrays. First an array A is divided into two auxiliary arrays A1 and A2. Now these auxiliary arrays are further divided until we reach a stage with an auxiliary array of 2 elements. These 2 elements are arranged in incremental order and merged with the previous divided arrays. So we can say that auxiliary array is used to implement the basic principle of merge sort.
The matrix multiplication in c language : c program is used to multiply matrices with two dimensional array. This program multiplies two matrices which will be entered by the user.
You don't need an array for that. Just do the multiplication, for example: result = factor1 * factor2; Or: result = 5 * 8;
To determine if an array is symmetric, the array must be square. If so, check each element against its transpose. If all elements are equal, the array is symmetric.For a two-dimensional array (a matrix) of order n, the following code will determine if it is symmetric or not:templatebool symmetric(const std::array& matrix){for (size_t r=0 ; r
The way that you can merge two businesses is that the two business owners need to agree on a merge and its price. This must then be taken up with the government. The Government will then agree or disagree on the whole merge. GCSE BUSINESS ANSWER There are two types of merge in business 1. Friendly 2. Hostile
You cannot. A C program can only have one global main function but you'd be trying to compile a program that has two main functions. The only way to merge the two programs is to modularise both programs so that neither is dependent upon their main functions. Once modularised, you can include those modules in any program. Alternatively, you can create binary libraries from the modules and link them into any program.
A two-dimensional array.