largest repeating string

1 view
Skip to first unread message

gaurav gupta

unread,
Aug 21, 2009, 1:23:13 AM8/21/09
to DS & Algo@itbhu
How do u find the largest repeating string and the number of times it
repeats in a given string efficiently offcourse !?
ex :

String : "abc fghi bc kl abcd lkm abcdefg"
Ans : "abcd" count = 2

--
GAURAV GUPTA
B.Tech IV Yr. , Department of Computer Science & Engineering
IT BHU , Varanasi
Contacts
Phone No: +91-99569-49491

e-mail :
gaurav...@acm.org
gaurav.gu...@itbhu.ac.in

Shishir Mittal

unread,
Aug 21, 2009, 6:28:28 AM8/21/09
to ds--al...@googlegroups.com

Longest repeated substring is an application of suffix tree.
Read more about it at http://www.allisons.org/ll/AlgDS/Tree/Suffix/
LOngest sorted substring is indicated by the deepest fork node in the suffix tree, where depth is measured by the number of  characters traversed from the root.
Time complexity : O(n)
--
Shishir Mittal
Ph: +91 9936 180 121
Reply all
Reply to author
Forward
0 new messages