Dsa Infix Conversion 70
Dsa Infix Conversion 70
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
typedef struct {
char arr[MAX];
int top;
} Stack;
s->top = -1;
s->arr[++s->top] = ch;
}
INFIX TO POSTFIX AND PREFIX
return 0;
str[len - i - 1] = temp;
Stack s;
init(&s);
int i, j = 0;
char ch = infix[i];
INFIX TO POSTFIX AND PREFIX
if (isalnum(ch)) {
postfix[j++] = ch;
push(&s, ch);
postfix[j++] = pop(&s);
pop(&s);
else {
postfix[j++] = pop(&s);
push(&s, ch);
postfix[j++] = pop(&s);
postfix[j] = '\0';
reverse(infix);
infixToPostfix(infix, prefix);
reverse(prefix);
int main() {
scanf("%s", infix);
infixToPostfix(infix, postfix);
infixToPrefix(infix, prefix);
return 0;