34
PROJECT BASED LAB REPORT On FUNCTIONS OF STRING USING SUFFIX ARRAY Submitted in partial fulfilment of the Requirements for the award of the Degree of Bachelor of Technology In Computer Science & Engineering By S.V.Rohith (150031000) P.Iswarya (150030684) K.Sri sai krishna (150030496)

A project on advanced C language

Embed Size (px)

Citation preview

Page 1: A project on advanced C language

PROJECT BASED LAB REPORT

On

FUNCTIONS OF STRING USING SUFFIX ARRAY

Submitted in partial fulfilment of the

Requirements for the award of the Degree of

Bachelor of Technology

In

Computer Science & Engineering

By

S.V.Rohith(150031000)

P.Iswarya (150030684)

K.Sri sai krishna (150030496)

Under the esteem guidance of

Page 2: A project on advanced C language

Sir, G.Swain DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

(DST-FIST Sponsored Department)

K L UniversityGreen Fields, Vaddeswaram, Guntur District-522 502

2015-2016

This is to certify that this project based lab report entitled “String functions using Suffix array” is a bonafide work done by the team.

S.V.Rohith (150031000)

P.Iswarya (150030684)

K.Sri sai krishna (150030496)

In partial fulfilment of the requirement for the award of degree in BACHELOR OF TECHNOLOGY in Computer Science and Engineering during the academic year 2015-

2016.

Faculty in charge Head of the Department

CERTIFICATE

Page 3: A project on advanced C language

K L UniversityDEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

(DST-FIST Sponsored Department)

Page 4: A project on advanced C language

We hereby declare that this project based lab report entitled “String functions using Suffix arrays” has been prepared by us in partial fulfilment of the requirement for the award of degree “BACHELOR OF TECHNOLOGY in COMPUTER SCIENCE AND ENGINEERING” during the academic year 2015-2016.

I also declare that this project based lab report is of our own effort and it has not been

submitted to any other university for the award of any degree.

Date: 18/04/16 S.V.Rohith (150031000)

Place: Vaddeswaram P.Iswarya (150030684)

K.Sri sai Krishna (150030382)

ACKNOWLEDGEMENTS

My sincere thanks to G.Swain in the Lab for their outstanding support throughout the project

for the successful completion of the work

DECLARATION

Page 5: A project on advanced C language

We express our gratitude to Dr.V.Srikanth, Head of the Department for Computer Science

and Engineering for providing us with adequate facilities, ways and means by which we are

able to complete this term paper work.

We would like to place on record the deep sense of gratitude to the honourable Vice

Chancellor, K L University for providing the necessary facilities to carry the concluded term

paper work.

Last but not the least, we thank all Teaching and Non-Teaching Staff of our department and

especially my classmates and my friends for their support in the completion of our term paper

work.

S.V.Rohith (150031000)

P.Iswarya (150030684)

K.Sri sai Krishna (150030382)

Page 6: A project on advanced C language

TABLE OF CONTENTS

Content Pg. No

1. Introduction and Description 1

1.1 Module 1: Longest repeated sub-string 31.2 Module 2: Longest common substring 41.3 Module 3: Longest palindrome of a string 5

2. Basic requirements and development of the program. 7

3. Longest repeated sub-string 8

3.1. Code of the module

3.2. outputs and reference frames

4. Longest common substring 13

4.1. Code of the module

4.2. outputs and reference frames

5. Longest palindrome in a string. 18

4.1. Code of the module

4.2. outputs and reference frames

6. References 20

Page 7: A project on advanced C language
Page 8: A project on advanced C language

1. INTRODUCTION

Advanced data structures is a part of c-language. C is a structured, high level machine independent language. C is converted to a lower language which was understood by the compiler. It allows the software developers to develop programs without worrying about the hardware plat forms where there will be implemented. The c language comes from the ALGOL which gives the concept structured programming to the computer science community. It was introduced early in 1960’s.

After, MARTIN RICHARDS DEVELOPED a language known as BCPL in 1967 for this in 1970’s ken Thompson created a language from BCPL and he called as “B” both BCPL and B are types less system programming languages. After finding ALGOL BCPL, AND B then from this c is evolved from that at BELL LABORATORIES in 1972 by “DENIS RITCHE”. C language uses many concepts from these and added the concept of data type because it was developed along with a UNIX operating system. UNIX is nothing but a most popular network operating system is used today and the heart of the internet data super high way. C-language is robust language because c-supports richest of operators and burden functions this consist of many operators, operands, key words, special characters, many characters.

Features of c-programming:-

It is a structural programming language with fundamental flow control construction.

It is highly portable. The program written on one computer can run on another computer also without any modification or with a slight modification.

It contains 32 keywords. It is simple and versatile programming language. It is richest than all programs. Dynamic memory allocation is possible in ‘c’.

Structures

We have seen that arrays can be used to represent a group of data items that belongs to same data type. If we want to represent a collection of data items of different data types using a single name, then we cannot use an array. C supports a constructed data type known as Structure, which is a method for packing data of different data types. A structure is a convenient tool for handling a group of logically related data items. Structures help to organize complex data in a more meaningful way. It is a powerful concept that we may often need to Use in our program design.

Page | 1

Page 9: A project on advanced C language

Definition:

A group of data items that belongs to different data types is known as Structure.

‘Struct’ : It is a keyword and is used to declare a Structure.

Declaration of structure:

struct struct_name {Data item-1;Data item-2; ………… …………Data item-n; };

Declaration of structure variable:

struct struct_name identifier;

(or) struct struct_name dentifier-1,identifier-2,.......,identifier-n;

(Access operator):

It is used to access the data items of a structure with the help of structure variable.

Syntax: struct_variable. Data item;

This includes all the declaration of data variables. Includes print statements. Dynamic memory allocation

Page | 2

Page 10: A project on advanced C language

SUFFIX ARRAY

In computer science, a suffix array is a sorted array of all suffixes of a string. It is a data structure used, among others, in full text indices, data compression algorithms and within the field of bioinformatics.

Suffix arrays were introduced by Manber & Myers (1990) as a simple, space efficient alternative to suffix trees. They have independently been discovered by Gaston Gonnet in 1987 under the name PAT array (Gonnet, Baeza-Yates & Snider 1992).

Task is to Build a Suffix Array and perform the following operations on the obtained Suffix Array.

Name of the Module

Function Number

Functions to be discharged

SUFFIX ARRAY

#1. Finding the longest repeated substring

#2. Finding the longest common substring

#3. Finding the longest palindrome in a string

The Title of the Program is to develop a program which deals with the combination of structures, arrays, and other functions. This program could do some operations on arrays such as insertion, deletion, sorting, searching, update, retrieve, merging, append, and exit.

By implementing this program we can execute the string related operations. To do this analysis manually it takes a lot of time and patience but by implementing this program using a high level language like C it becomes much easier. But before going to make final solution for the problem, the problem must be analysed.

First of all the basic information regarding the program which consists of complex numbers. This program is solved by using several methods like one can solve this program using user defined functions concept, loops conditions, go to statements. In this

Page | 3

Page 11: A project on advanced C language

abstract we used the concept of functions, while loop, for loop, switch case and if condition’s which helps to execute the problem much easier .The following steps are followed while implementing the given program using if and while loop.

The input is entered i.e., the value of choice (the menu no) select the particular menu. Next it goes to particular menu and then go to the particular function. It prints the resultant value which came from the execution.

Longest Repeated Substring In computer science, the longest repeated substring problem is the problem of finding the longest substring of a string that occurs at least twice. This problem can be solved in linear time and space by building a suffix tree for the string, and finding the deepest internal node in the tree. Depth is measured by the number of characters traversed from the root. The string spelled by the edges from the root to such a node is a longest repeated substring. The problem of finding the longest substring with at least k occurrences can be solved by first pre-processing the tree to count the number of leaf descendants for each internal node, and then finding the deepest node with at least k leaf descendants that have no children. In the figure with the string "ATCGATCGA$", the longest repeated substring is "ATCGA", and repeats twice.

Page | 4

Page 12: A project on advanced C language

Longest Common Substring

In computer science, the longest common substring problem is to find the longest string (or strings) that is a substring (or are substrings) of two or more strings. The longest common substring of the strings "ABABC", "BABCA" and "ABCBA" is string "ABC" of length 3. Other common substrings are "A", "AB", "B", "BA", "BC" and "C".

Page | 5

Page 13: A project on advanced C language

Longest Palindrome in a String

In computer science, the longest palindromic substring or longest symmetric factor problem is the problem of finding a maximum-length contiguous substring of a given string that is also a palindrome. For example, the longest palindromic substring of "bananas" is "anana". The longest palindromic substring is not guaranteed to be unique; for example, in the string "abracadabra", there is no palindromic substring with length greater than three, but there are two palindromic substrings with length three, namely, "aca" and "ada". In some applications it may be necessary to return all maximal palindromic substrings (that is, all substrings that are themselves palindromes and cannot be extended to larger palindromic substrings) rather than returning only one substring or returning the maximum length of a palindromic substring.Manacher (1975) found a linear time algorithm for listing all the palindromes that appear at the start of a given string. However, as observed e.g., by Apostolico, Breslauer & Galil (1995), the same algorithm can also be used to find all maximal palindromic substrings anywhere within the input string, again in linear time. Therefore, it provides a linear time solution to the longest palindromic substring problem. Alternative linear time solutions were provided by Jeuring (1994), and by Gusfield (1997), who described a solution based on suffix trees. Efficient parallel algorithms are also known for the problem.

Page | 6

Page 14: A project on advanced C language

2. Requirements and Development

SOFTWARE REQUIREMENTS:

• This application is developed in Microsoft windows Xp or later operating system.• This Phonebook application is coded and made using the following compilers:

Page | 7

Page 15: A project on advanced C language

1. Code::blocks.

2. Turbo c.

3. Dos Box

HARDWARE REQUIREMENTS:

• The Application size is 38Kb and the size of the code is 5Kb required by the hard disk.

• RAM: minimum 256MB.• Some basic components like mouse, keyboard, Display monitor…

3.Longest repeated sub-string

Algorithm:

Page | 8

Page 16: A project on advanced C language

1. Start the basic: including the header files2. Declaring required number of structure variable and pointer variable.3. *start,*end interval specifies the edge, by which the node is connected to its

parent node. Each edge will connect two nodes, one parent and one child, and (start, end) interval of a given edge will be stored in the child node

4. leaf nodes, it stores the index of suffix for the path from root to leaf.5. Take an input variable string and pointer to root node.6. activeEdge is represented as input string character index.7. For root node, suffixLink will be set to NULL For internal nodes, suffixLink

will be set to root by default in current extension and may change in next extension

8. suffixIndex will be set to -1 by default and actual suffix index will be set later for eaves at the end of all phases

9. activePoint change for walk down (APCFWD) using Skip/Count Trick (Trick 1). If activeLength is greater than current edge length, set next internal node as activeNode and adjust activeEdge and activeLength accordingly to represent same activePoint.

10. Now the module going to perform the required operation of finding the longest repeated string is performed.

11. Displaying the appropriate output 12. Exit the program.

CODING AND EXECUTION#include <stdio.h>#include <string.h>#include <stdlib.h>#define MAX_CHAR 256struct SuffixTreeNode {struct SuffixTreeNode *children[MAX_CHAR];struct SuffixTreeNode *suffixLink;int start,suffixindex;int *end;};typedef struct SuffixTreeNode Node;char text[100];Node *root=NULL;Node *lastNewNode=NULL;Node *activeNode=NULL;int activeEdge=-1, activeLength=0,remainingSuffixCount=0,leafEnd=-1,size=-1;int *rootEnd=NULL;int *splitEnd=NULL;Node *newNode(int start,int *end){Node *node =(Node*)malloc(sizeof(Node));

Page | 9

Page 17: A project on advanced C language

int i;for(i=0;i<MAX_CHAR;i++)node->children[i]=NULL;node->suffixLink=root;node->start=start;node->end=end;node->suffixIndex=-1;return node;}int edgeLength(Node *n) {if(n==root)return 0;return *(n->end)-(n->start)+1;}int walkDown(Node *currNode){if(activeLength>=edgeLength(currNode)){activeEdge+=edgeLength(currNode);activeLength-=edgeLength(currNode);activeNode=currNode;return 1;}return 0;}void extendSuffixTree(int pos){Node *split=newNode(next->start, splitEnd);leafEnd=pos;remainingSuffixCount++;lastNewNode=NULL;while(remainingSuffixCount>0){if(activeLength==0)activeEdge=pos;if(activeNode->children[text[activeEdge]]==NULL){activeNode->children[text[activeEdge]]=newNode(pos,&leafEnd);if(lastNewNode!=NULL){lastNewNode->suffixLink=activeNode;lastNewNode=NULL;}}else{Node *next=activeNode->children[text[activeEdge]];if(walkDown(next)){continue;}if(text[next->start+activeLength]==text[pos]){if(lastNewNode!=NULL&&activeNode!=root){lastNewNode->suffixLink=activeNode;lastNewNode=NULL;}activeLength++;break;}splitEnd=(int*)malloc(sizeof(int));

Page | 10

Page 18: A project on advanced C language

*splitEnd=next->start+activeLength-1;activeNode->children[text[activeEdge]]=split;split->children[text[pos]]=newNode(pos,&leafEnd);next->start+=activeLength;split->children[text[next->start]]=next;if(lastNewNode!=NULL){lastNewNode->suffixLink=split;}lastNewNode=split;}remainingSuffixCount--;if(activeNode==root&&activeLength>0){activeLength--;activeEdge=pos-remainingSuffixCount + 1;}else if(activeNode!=root){activeNode=activeNode->suffixLink;}}}void print(int i,int j){int k;for(k=i;k<=j;k++)printf("%c",text[k]);}void setSuffixIndexByDFS(Node *n,int labelHeight){int leaf=1;if(n==NULL)return;int i;for(i=0;i<MAX_CHAR;i++){if(n->children[i]!=NULL){leaf=0;setSuffixIndexByDFS(n->children[i],labelHeight+edgeLength(n->children[i]));}}if(leaf==1){n->suffixIndex=size-labelHeight;printf("[%d]\n",n->suffixIndex);}}void freeSuffixTreeByPostOrder(Node *n){if(n==NULL)return;int i;for(i=0;i<MAX_CHAR;i++){if(n->children[i]!=NULL){freeSuffixTreeByPostOrder(n->children[i]);}}if(n->suffixIndex==-1)free(n->end);

Page | 11

Page 19: A project on advanced C language

free(n);}void buildSuffixTree(){size=strlen(text);int i;rootEnd=(int*)malloc(sizeof(int));*rootEnd=-1;root=newNode(-1,rootEnd);activeNode=root;for(i=0;i<size;i++)extendSuffixTree(i);int labelHeight=0;setSuffixIndexByDFS(root,labelHeight);}void doTraversal(Node *n,int labelHeight,int* maxHeight,int* substringStartIndex){if(n==NULL){return;}int i=0;if(n->suffixIndex==-1){for(i=0;i<MAX_CHAR;i++){if(n->children[i]!=NULL){doTraversal(n->children[i],labelHeight+edgeLength(n->children[i]),maxHeight,substringStartIndex);}}}else if(n->suffixIndex>-1&&(*maxHeight<labelHeight-edgeLength(n))){*maxHeight=labelHeight-edgeLength(n);*substringStartIndex=n->suffixIndex;}}void getLongestRepeatedSubstring(){int maxHeight=0,k,substringStartIndex=0;doTraversal(root,0,&maxHeight,&substringStartIndex);printf("maxHeight %d, substringStartIndex %d\n",maxHeight,substringStartIndex);printf("Longest Repeated Substring in %s is: ",text);for (k=0;k<maxHeight;k++)printf("%c",text[k+substringStartIndex]);if(k == 0)printf("No repeated substring\n");}int main(int argc,char *argv[]){strcpy(text,"ABCDEFG$");buildSuffixTree();getLongestRepeatedSubstring();freeSuffixTreeByPostOrder(root);strcpy(text,"ATCGATCGA$");buildSuffixTree();getLongestRepeatedSubstring();freeSuffixTreeByPostOrder(root);strcpy(text,"pqrpqpqabab$");buildSuffixTree();

Page | 12

Page 20: A project on advanced C language

getLongestRepeatedSubstring();freeSuffixTreeByPostOrder(root);return 0;}

Since the input is already made in the program the output is executed in the following way:

4. Longest common substring

Algorithm:

1. Start the basic: including the header files2. Declaring required number of structure variable and pointer variable.

Page | 13

Page 21: A project on advanced C language

3. *start,*end interval specifies the edge, by which the node is connected to its parent node. Each edge will connect two nodes, one parent and one child, and (start, end) interval of a given edge will be stored in the child node

4. leaf nodes, it stores the index of suffix for the path from root to leaf.5. Take an input variable string and pointer to root node.6. activeEdge is represented as input string character index.7. For root node, suffixLink will be set to NULL For internal nodes, suffixLink

will be set to root by default in current extension and may change in next extension

8. suffixIndex will be set to -1 by default and actual suffix index will be set later for eaves at the end of all phases

9. activePoint change for walk down (APCFWD) using Skip/Count Trick (Trick 1). If activeLength is greater than current edge length, set next internal node as activeNode and adjust activeEdge and activeLength accordingly to represent same activePoint.

10. Now the module going to perform the required operation of finding the longest common string is performed.

11. Displaying the appropriate output 12. Exit the program.

CODING AND EXECUTION

#include <stdio.h>#include <string.h>#include <stdlib.h>#define MAX_CHAR 256struct SuffixTreeNode {struct SuffixTreeNode *children[MAX_CHAR];struct SuffixTreeNode *suffixLink;int start,suffixIndex;int *end;};typedef struct SuffixTreeNode Node;char text[100];Node *root=NULL;Node *lastNewNode=NULL;Node *activeNode=NULL;int activeEdge=-1,activeLength=0,remainingSuffixCount=0,leafEnd=-1;int *rootEnd=NULL;int *splitEnd=NULL;int size=-1,size1=0;

Page | 14

Page 22: A project on advanced C language

Node *newNode(int start,int *end) {Node *node=(Node*)malloc(sizeof(Node));int i;for(i=0;i<MAX_CHAR;i++)node->children[i]=NULL;node->suffixLink=root;node->start=start;node->end=end;node->suffixIndex=-1;return node;}int edgeLength(Node *n){if(n==root)return 0;return *(n->end)-(n->start)+1;}int walkDown(Node *currNode){if(activeLength>=edgeLength(currNode)){activeEdge+=edgeLength(currNode);activeLength-=edgeLength(currNode);activeNode=currNode;return 1;}return 0;}void extendSuffixTree(int pos){leafEnd=pos;remainingSuffixCount++;lastNewNode=NULL;while(remainingSuffixCount>0){if(activeLength==0)activeEdge=pos;if(activeNode->children[text[activeEdge]]==NULL){activeNode->children[text[activeEdge]]=newNode(pos,&leafEnd);if(lastNewNode!=NULL){lastNewNode->suffixLink=activeNode;lastNewNode=NULL;}}else{Node *next=activeNode->children[text[activeEdge]];if(walkDown(next)){continue;}if(text[next->start+activeLength]==text[pos]){if(lastNewNode!=NULL&&activeNode!=root){lastNewNode->suffixLink=activeNode;lastNewNode=NULL;}activeLength++;break;}splitEnd=(int*)malloc(sizeof(int));*splitEnd=next->start+activeLength-1;

Page | 15

Page 23: A project on advanced C language

activeNode->children[text[activeEdge]]=split;split->children[text[pos]]=newNode(pos,&leafEnd);next->start+=activeLength;split->children[text[next->start]]=next;if(lastNewNode!=NULL)lastNewNode->suffixLink=split;lastNewNode=split;}remainingSuffixCount--;if(activeNode==root&&activeLength>0){activeLength--;activeEdge=pos-remainingSuffixCount+1;}else if(activeNode!=root)activeNode=activeNode->suffixLink;}}void print(int i,int j){int k;for(k=i;k<=j&&text[k]!='#';k++)printf("%c",text[k]);if(k<=j)printf("#");}void setSuffixIndexByDFS(Node *n,int labelHeight){int i,leaf=1;if(n==NULL)return;if(n->start!=-1)print(n->start,*(n->end));for(i=0;i<MAX_CHAR;i++){if(n->children[i]!=NULL){leaf=0;setSuffixIndexByDFS(n->children[i],labelHeight+edgeLength(n->children[i]));} }if(leaf==1){for(i=n->start;i<=*(n->end);i++){if(text[i]=='#'){n->end=(int*)malloc(sizeof(int));*(n->end)=i;}}n->suffixIndex=size-labelHeight;}}void freeSuffixTreeByPostOrder(Node *n){int i;if(n==NULL)return;for(i=0;i<MAX_CHAR;i++){if(n->children[i]!=NULL){freeSuffixTreeByPostOrder(n->children[i]);}

Page | 16

Page 24: A project on advanced C language

}if(n->suffixIndex==-1)free(n->end);free(n);}void buildSuffixTree(){int i,labelHeight=0;size=strlen(text);rootEnd=(int*)malloc(sizeof(int));*rootEnd=-1;root=newNode(-1,rootEnd);activeNode=root;for(i=0;i<size;i++)extendSuffixTree(i);setSuffixIndexByDFS(root,labelHeight);}int doTraversal(Node *n,int labelHeight,int* maxHeight,int* substringStartIndex){int i=0,ret=-1;if(n==NULL)return;if(n->suffixIndex<0){for(i=0;i<MAX_CHAR;i++){if(n->children[i]!=NULL){ret=doTraversal(n->children[i],labelHeight+edgeLength(n->children[i]),maxHeight,substringStartIndex);if(n->suffixIndex==-1)n->suffixIndex=ret;else if((n->suffixIndex==-2&&ret==-3)||(n->suffixIndex==-3&&ret==-2)||n->suffixIndex==-4){n->suffixIndex=-4;if(*maxHeight<labelHeight){*maxHeight=labelHeight;*substringStartIndex=*(n->end)-labelHeight+1;} } } } }else if(n->suffixIndex>-1&&n->suffixIndex<size1)return -2;else if(n->suffixIndex> size1)return -3;return n->suffixIndex;}void getLongestCommonSubstring(){int k,maxHeight=0,substringStartIndex=0;doTraversal(root,0,&maxHeight,&substringStartIndex);for(k=0;k<maxHeight;k++)printf("%c",text[k+substringStartIndex]);if(k==0)printf("No common substring");elseprintf(", of length: %d",maxHeight);printf("\n");}int main(int argc, char *argv[]){size1=6;printf("Longest Common Substring in abcde and fghie is: ");strcpy(text,"abcde#fghie$"); buildSuffixTree();

Page | 17

Page 25: A project on advanced C language

getLongestCommonSubstring();freeSuffixTreeByPostOrder(root);size1=6;printf("Longest Common Substring in pqrst and uvwxyz is: ");strcpy(text, "pqrst#uvwxyz$"); buildSuffixTree();getLongestCommonSubstring();freeSuffixTreeByPostOrder(root);return 0;}

Since the input is already made in the program the output is executed in the following way:

5.Longest palindrome in a string

Algorithm:

1. Start the basic: including the header files2. Declaring required number of structure variable and pointer variable.3. *start,*end interval specifies the edge, by which the node is connected to its

parent node. Each edge will connect two nodes, one parent and one child, and (start, end) interval of a given edge will be stored in the child node

Page | 18

Page 26: A project on advanced C language

4. leaf nodes, it stores the index of suffix for the path from root to leaf.5. Take an input variable string and pointer to root node.6. activeEdge is represented as input string character index.7. For root node, suffixLink will be set to NULL For internal nodes, suffixLink

will be set to root by default in current extension and may change in next extension

8. suffixIndex will be set to -1 by default and actual suffix index will be set later for eaves at the end of all phases

9. activePoint change for walk down (APCFWD) using Skip/Count Trick (Trick 1). If activeLength is greater than current edge length, set next internal node as activeNode and adjust activeEdge and activeLength accordingly to represent same activePoint.

10. Now the module going to perform the required operation of finding the longest palindrome in a string is performed.

11. Displaying the appropriate output 12. Exit the program.

CODING AND EXECUTION#include <stdio.h>#include <string.h>void printSubStr(char* str, int low, int high){int i;for(i=low;i<=high;++i)printf("%c",str[i]);}int longestPalSubstr(char *str){int maxLength=1;int start=0,len=strlen(str),i,low,high;for(i=1;i<len;++i){low=i-1;high=i;while(low>=0&&high<len&&str[low]==str[high]){if(high-low+1>maxLength){start=low;maxLength=high-low+1;}--low;++high;}low=i-1;high=i+1;while(low>=0&&high<len&&str[low]==str[high]){if(high-low+1>maxLength){

Page | 19

Page 27: A project on advanced C language

start=low;maxLength=high-low+1;}--low;++high;}}printf("Longest palindrome substring is: ");printSubStr(str,start,start+maxLength-1);return maxLength;}void main(){char str[]="svrohith9";clrscr();printf("\nLength is: %d\n",longestPalSubstr(str));getch();}

Since the input is already made in the program the output is executed in the following way:

6. REFERENCES

We checked out the most available content that we can find from the internet and used in our project.

https://en.wikipedia.org/wiki/Suffix_array

Page | 20