Lets say we have List of suffixes for String banana - banana, anana, nana, ana, na, a. I was able to put each suffix in a bucket. like suffix that starts from 'a' will be in one bucket and suffix that starts with 'b' will be in other bucket. Same for n as well. But I was not able to sort strings lexicographically in a bucket efficiently. say bucket a should look like this - a, ana, anana. Because of this I am not able to solve this problem efficiently in java - http://www.spoj.com/problems/SARRAY/ I have been stuck for days now. Any piece of code/suggestions is much appreciated.
Asked
Active
Viewed 251 times
0
-
Is your goal to construct a suffix array using bucket sort _only_? No other techniques? That will be an O(n²) algorithm then...? – jogojapan Aug 04 '15 at 23:05
-
Actually I was trying to implement suffix array in java using bucket sort. Agreed that it would be o(n2) I want to get it done using the best solution. Is it possible for you to provide a code snippet for same? – Ankit Pandoh Aug 19 '15 at 09:28