1. What will be the output of the following programs.
a) #include <stdio.h>
Main()
{
Int x=4;
While(x==1)
{
X=x-1;
Printf(ā%dā,x);
--x;
}
}
Post New Answer View All Answers
What is optimization in c?
What is a nested loop?
Explain that why C is procedural?
What are the __date__ and __time__ preprocessor commands?
What is the right type to use for boolean values in c? Is there a standard type? Should I use #defines or enums for the true and false values?
What are local static variables? How can you use them?
Explain two-dimensional array.
Describe static function with its usage?
What is pointer and structure in c?
How do we declare variables in c?
i = 25;switch (i) {case 25: printf("The value is 25 ");case 30: printf("The value is 30 "); When the above statements are executed the output will be : a) The value is 25 b) The value is 30 c) The value is 25 The value is 30 d) none
What is the scope of static variable in c?
Why do some versions of toupper act strangely if given an upper-case letter?
How can you determine the maximum value that a numeric variable can hold?
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