jugal_sahu's blog

By jugal_sahu, 10 years ago, In English

Problem Link

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.

My C++ code

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... :)

  • Vote: I like it
  • -14
  • Vote: I do not like it

»
8 years ago, # |
  Vote: I like it +5 Vote: I do not like it

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.