struct node{
int data;
struct node *left, *right;
};
typedef struct node node;
non recursive method :
main()
{
node * root = NULL , *new = NULL *temp1 =NULL , * temp2 = NULL;
int num =1;
printf(" Enter the elements of the tree( enter 0 to exit)\n");
while(1)
{
scanf("%d", &num);
if(num==0)
break;
new = malloc(sizeof(node));
new->left = new->right = NULL;
new->data = num;
if( root NULL)
root->left = new;
else
insert( new,root->left);
}
}
#include <stdio.h>
void main()
{
int digi,num,i,sum=0;
printf("Enter the number of digits:");
scanf("%d",&num);
while(i>0);
{
for(i=0;i<10000;i++)
{
digi=num;
i=digi%10;
sum=sum+i;
num=digi/10;
}
printf("The sum of digits entered is %d",sum);
}
}
#include
#include
#include
struct NODE
{
int data;
struct NODE *leftchild;
struct NODE *rightchild;
};
struct NODE *Binary_Tree(char *,int,int);
void display(struct NODE *,int);
void Pre_order(struct NODE *);
void In_order(struct NODE *);
void Post_order(struct NODE *);
/* Function to create a binary tree */
struct NODE * Binary_Tree(char *List,int Lower,int Upper)
{
struct NODE *Node;
int Mid=(Lower + Upper)/2;
Node=(struct NODE*)malloc(sizeof(struct NODE));
Node->data=List[Mid];
if(Lower>=Upper)
{
Node->leftchild=NULL;
Node->rightchild=NULL;
return(Node);
}
if(Lower <=Mid-1)
Node->leftchild=Binary_Tree(List,Lower,Mid-1);
else
Node->leftchild=NULL;
if(Mid+1<=Upper)
Node->rightchild=Binary_Tree(List,Mid+1,Upper);
else
Node->rightchild=NULL;
return(Node);
}
/* Output function */
void display(struct NODE *T,int Level)
{
int i;
if(T)
{
display(T->rightchild,Level+1);
printf("\n");
for(i=0;i
printf(" ");
printf(" %d",T->data);
display(T->leftchild,Level+1);
}
}
/* Pre-order traversal */
void Pre_order(struct NODE *Node)
{
if(Node)
{
printf(" %d",Node->data);
Pre_order(Node->leftchild);
Pre_order(Node->rightchild);
}
}
/* In-order traversal */
void In_order(struct NODE *Node)
{
if(Node)
{
In_order(Node->leftchild);
printf(" %d",Node->data);
In_order(Node->rightchild);
}
}
/* Post-order traversal */
void Post_order(struct NODE *Node)
{
if(Node)
{
Post_order(Node->leftchild);
Post_order(Node->rightchild);
printf(" %d",Node->data);
}
}
/* Function Main */
void main()
{
char List[100];
int Number=0;
int info;
char choice;
struct NODE *T=(struct NODE*)malloc(sizeof(struct NODE));
T=NULL;
printf("\n Input Choice 'b' to break : ");
choice=getchar();
fflush(stdin);
while(choice != 'b')
{
printf("\n Input information of the node : ");
scanf("%d",&info);
List[Number++]=info;
fflush(stdin);
printf("\n Input choice 'b' to break : ");
choice=getchar();
fflush(stdin);
}
Number--;
printf("\n Number of elements in the list is %d ",Number);
T=Binary_Tree(List,0,Number);
display(T,1);
printf("\n Pre-order traversal \n");
Pre_order(T);
printf("\n In-order traversal \n");
In_order(T);
printf("\n Post-order traversal \n");
Post_order(T);
}
It is possible, you'll have to use a structure like this:
typedef struct TreeElement {
struct TreeElement *left, *right;
int data;
} TreeElement;
1010101
dfgbrgffee
write a c++ program to convert binary number to decimal number by using while statement
write a c program that takes a binary file as input and finds error check using different mechanisms.
Don't write, it is already written, google for 'cpp'.
You are not able to do that, but you can write a program, that uses the system-call./* exectest.c */#include int main (void){execlp ("/bin/ls", "ls", "-ld", ".", NULL);return 0;}
to implement operations on binary heap in c
dfgbrgffee
write a c++ program to convert binary number to decimal number by using while statement
yes
give me the program which can related on domain and referential integrity.
write a c program that takes a binary file as input and finds error check using different mechanisms.
Don't write, it is already written, google for 'cpp'.
A program in c language to implement framing methods like character stuffing can be grave sizeCRC-32 and the variable c50.
lund lelo mooh mein
It can be implemented very easily .... Suppose the Binary word is X7X6X5.... X0 then the corresponding Gray code is G7G6G5....G0 where G7=X7 G6=X7 XOR X6 G5=X6 XOR X5 ..... G0=X1 XOR X0 Now implement the above algorithm
networking
You are not able to do that, but you can write a program, that uses the system-call./* exectest.c */#include int main (void){execlp ("/bin/ls", "ls", "-ld", ".", NULL);return 0;}