I was trying to solve Distinct Substrings on spoj.I know it can be solved using Suffix Array But I think it can also be solved using Trie......here is my solution which is getting SIGSEGV (don't know why).Please tell me where i am wrong.
what i did: for string ABABABB taking substring of it : ABABABB BABABB ABABB BABB ABB BB B putting it into Trie one by one.Whenever new character is inserted count is increased by one. Each node has 26 child.
Can anybody tell me why i am getting SIGSEGV. Thanks in Advance... :)
I haven't solved the problem yet, but this comment from spoj looks relevant to your case..
Dont assume the characters to be alphabetical, dont subtract 'A' in deciding the rank.