write a function that accepts an array A with n elements and
array B with n-1 elements. Find the missing one in array
B,with an optimized manner?
Answer Posted / aravind
#include<stdio.h>
int missing_item(int,int);
int main()
{
int a[10];
int b[9];
printf("enter size of array");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("enter the elemets of array a ");
scanf("%d",&a);
}
for(i=0;i<n-1;i++)
{
printf("enter b elements");
scanf("%d",&b);
missing_item(int c,int d)
{
int item;
for(i=0;i<n;i++)
{
if(c[i]==d[i])
break;
else
{
item=c[i];
printf("the missing item is=%d",c[i]);
}
}
| Is This Answer Correct ? | 0 Yes | 2 No |
Post New Answer View All Answers
Array is an lvalue or not?
what are the program that using a two dimensional array that list the odd numbers and even numbers separately in a given 10 inputs values
What is optimization in c?
How do I use strcmp?
What are derived data types in c?
what is the basis for selection of arrays or pointers as data structure in a program
Which programming language is best for getting job 2020?
Write a Program to accept different goods with the number, price and date of purchase and display them
Can you please explain the difference between syntax vs logical error?
Differentiate between the = symbol and == symbol?
write a program to rearrange the array such way that all even elements should come first and next come odd
You have given 2 array. You need to find whether they will
create the same BST or not.
For example:
Array1:10 5 20 15 30
Array2:10 20 15 30 5
Result: True
Array1:10 5 20 15 30
Array2:10 15 20 30 5
Result: False
One Approach is Pretty Clear by creating BST O(nlogn) then
checking two tree for identical O(N) overall O(nlogn) ..we
need there exist O(N) Time & O(1) Space also without extra
space .Algorithm ??
DevoCoder
guest
Posted 3 months ago #
#define true 1
#define false 0
int check(int a1[],int a2[],int n1,int n2)
{
int i;
//n1 size of array a1[] and n2 size of a2[]
if(n1!=n2) return false;
//n1 and n2 must be same
for(i=0;i
Explain the red-black trees?
What are the two types of structure?
Is array name a pointer?