please give code for this 1 2 4 7 11 16
Answer Posted / kiran
#include<stdio.h>
#include<conio.h>
void main()
{
int p=1;
for(int i=1;i<=5;i++)
{
printf("%d ",p);
p+=i;
}
getch();
}
Is This Answer Correct ? | 34 Yes | 21 No |
Post New Answer View All Answers
Why is %d used in c?
What is the use of the function in c?
what is bit rate & baud rate? plz give wave forms
disply the following menu 1.Disply 2.Copy 3.Append; as per the menu do the file operations 4.Exit
How do you construct an increment statement or decrement statement in C?
How do you use a pointer to a function?
Explain what are the standard predefined macros?
What is string concatenation in c?
What is an example of structure?
What is the -> in c?
What are linker error?
What does %p mean?
What do you understand by friend-functions? How are they used?
What are the types of data files?
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