Professional Documents
Culture Documents
Finalprojectds Group12
Finalprojectds Group12
SECTION 42
GROUP 12
ANSWER
INORDER TRAVERSAL : D C E B A F H G I J K
PREORDER TRAVERSAL : A B C D E F G H I J K
POSTORDER TRAVERSAL : D E C B F A H I G J K
2
QUESTION 21
ANSWER
CODING
#include <stdio.h>
#include <conio.h>
#include <string.h>
int main()
{
return 0;
OUTPUT
CODING 2
#include <stdio.h>
#include <string.h>
struct stack
{
char data[100];
int top;
};
void push(struct stack *s, char x) {s->data[++s->top]=x;}
char pop(struct stack *s) {return (s->data[s->top--]);}
int main()
{
struct stack s;
s.top=-1;
char string[100];
int palin, l, count;
printf("Type in a string to check if it is a Palindrome\n");
scanf("%s", string);
l=strlen(string);
if(l==1) {palin=1;}
else
{ count =0;
while (string[count]!='\0')
{
push(&s, string[i]);
i++;
}
count =0;
while (string[count]!='\0')
{
if(string[count]!=pop(&s)) {palin=0;}
count ++;
}
}
if(palin==0) {printf("Not Palindrome\n");}
else {printf("Palindrome\n");}
}
OUTPUT