I need part B to be in C language please thank you Joint suffix tree A). Draw a
ID: 3794344 • Letter: I
Question
I need part B to be in C language please thank you
Joint suffix tree
A). Draw a joint suffix tree for three strings ACTAC, ATCAT, TCACT. Label the edges and terminal nodes.
B). Describe an efficient algorithm to find the minimum length l for a set of strings T1, T2, . . ., Tk, such that there exist a unique signature substring of length l for each string. For example, if T1 = ACGACGTA, T2 = ACTATGAC, and T3 = GATAGTA, the smallest l = 2, since a signature of length 2 can be found for each string: CG only appears in T1, CT only in T2 and AG only in T3, and there is no unique substring of length 1 for all sequences.
Explanation / Answer
#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<stdlib.h>
char stack[50];
int top=-1;
void in_to_po(char infix[]);
void push(char);
char pop();
void main()
{
char infix[25];
clrscr();
printf("Enter infix notation :");
gets(infix);
printf(" Postfix Notation is :");
in_to_po(infix);
getch();
}
void push(char sym)
{
if(top>=49)
{
printf("Stack over flow");
getch();
exit(0);
}
else
{
top=top+1;
stack[top]=sym;
}
}
char pop()
{
char item;
if(top==-1)
{
printf("Stack is empty");
getch();
exit(0);
}
else
{
item=stack[top];
top=top-1;
}
return(item);
}
int pre(char ch)
{
if(ch==45)
{
return(5);
}
else
if(ch==42)
{
return(4);
}else if(ch==43)
{
return(3);
}
else
return(2);
}
void in_to_po(char infix[])
{
int length;
static int index=0,pos=0;
char symbol,temp;
char postfix[40];
length=strlen(infix);
push('#');
while(index<length)
{
symbol=infix[index];
switch(symbol)
{
case'(':push(symbol);
break;
case')':temp=pop();
while(temp!='(')
{
postfix[pos]=temp;
pos++;
temp=pop();
}
break;
case'+':
case'-':
case'*':
case'/':
case'^':
while(pre(stack[top])>=pre(symbol))
{
temp=pop();
postfix[pos]=temp;
pos++;
}
push(symbol);
break;
default:postfix[pos++]=symbol;
break;
}
index++;
}
while(top>0)
{
temp=pop();
postfix[pos++]=temp;
}
postfix[pos++]='';
puts(postfix);
return;
}