#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();
}
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
Merge sort is a divide-and-conquer algorithm used in data structures to sort an array or list. It works by recursively splitting the input array into two halves, sorting each half, and then merging the sorted halves back together. The process continues until the entire array is sorted. Merge sort is efficient, with a time complexity of O(n log n), making it suitable for large datasets.
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.
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
Merge sort is a divide-and-conquer algorithm used in data structures to sort an array or list. It works by recursively splitting the input array into two halves, sorting each half, and then merging the sorted halves back together. The process continues until the entire array is sorted. Merge sort is efficient, with a time complexity of O(n log n), making it suitable for large datasets.
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.
One efficient Java implementation for finding the median of two sorted arrays is to merge the arrays into one sorted array and then calculate the median based on the length of the combined array.
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.
To find the median of two arrays when combined into a single array, first merge the arrays and then calculate the median by finding the middle value if the total number of elements is odd, or by averaging the two middle values if the total number of elements is even.
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