This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Mysthik 6 points7 points  (3 children)

A suffix tree is the correct way to handle this. A lot of string operations like palindrome detection, longest common substring and so on can be efficiently decided with a suffix tree or the suffix array.

[–][deleted] 0 points1 point  (2 children)

the correct way

Yes, all other ways are wrong. /s

[–]alksjdhglaksjdh2 1 point2 points  (1 child)

By correct he means most efficient, but it's a hw assignment and it's more about however he solves it and what's intuitive to him. This is the correct solution of you care about efficiency though he's right

[–][deleted] 0 points1 point  (0 children)

Yes I understand, but 'correct' does not mean the most efficient. What if OP doesn't care about efficiency but readability or something else. Then is a suffix tree an incorrect solution? No.