Posts

C program in data structure for storage representation of 2-D array

#include<stdio.h> #include<conio.h> void main() {  int a[10][10],i,j,r,c;  clrscr();  printf("\n Enter row and column number:-");  scanf("%d%d",&r,&c);  printf("\n Enter %d*%d matrix:-",r,c);  for(i=0;i<r;i++)  {   for(j=0;j<c;j++)   {    scanf("%d",&a[i][j]);   }  }  printf("\n storage representation of 2-D array:-");  for(i=0;i<r;i++)  {   for(j=0;j<c;j++)   {    printf("\n[%d][%d]= %d",i,j,a[i][j]);   }   printf("\n");  }  getch(); } /* OUTPUT  Enter row and column number:-3 3                                                                                             ...

C program for preorder inorder postorder in data structure

#include<stdio.h> #include<conio.h> #include<process.h> #include<stdlib.h> struct node {  int info;  struct node *llink;  struct node *rlink; }*root=NULL; void insert(); void preorder(struct node *q); void inorder(struct node *q); void postorder(struct node *q); int stack[10]; int top=-1; void main() {  int n;  clrscr();  while(1)  {   printf("\n **menu**");   printf("\n 1.insert \n 2.preorder");   printf("\n 3.inorder \n 4.postorder");   printf("\n 5.exit");   printf("\n enter your choice:-");   scanf("%d",&n);   switch(n)   {    case 1 : insert();    break;    case 2 : preorder(root);    break;    case 3 : inorder(root);    break;    case 4 : postorder(root);    break;    case 5 : exit(0);   }  }  getch(); } void insert() { ...