Hi All,Could somebody explain me what is idea behind suffix sorting in context of suffix array.
i know usual sorting algorithm,but what actually is idea behind mayer and mayber algorithm?
№ | Пользователь | Рейтинг |
---|---|---|
1 | tourist | 4009 |
2 | jiangly | 3823 |
3 | Benq | 3738 |
4 | Radewoosh | 3633 |
5 | jqdai0815 | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | ksun48 | 3390 |
10 | gamegame | 3386 |
Страны | Города | Организации | Всё → |
№ | Пользователь | Вклад |
---|---|---|
1 | cry | 167 |
2 | Um_nik | 163 |
3 | maomao90 | 162 |
3 | atcoder_official | 162 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 156 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
9 | nor | 153 |
Hi All,Could somebody explain me what is idea behind suffix sorting in context of suffix array.
i know usual sorting algorithm,but what actually is idea behind mayer and mayber algorithm?
Название |
---|
DC3 is faster!!!
Do you know about number sort? Theory, it's O(n).
I think this file would be useful :
http://www.stanford.edu/class/cs97si/suffix-array.pdf
Thanks MMJ :)
This pdf says "The algorithm is mainly based on maintaining the order of the string’s suffixes sorted by their 2k long prefixes".
could you explain me how actually this idea works?
I have recently learned this algorithm, so excuse me for my poor explanation.(and my poor English :D)
consider we have a string S and we want to sort all suffix of S in O(nlgn * lgn).
first of all we add some extra character to the end of S that they're maximum character in our alphabet.
then for every j (1 <= 2^j < 2^k) such that 2^k is first power of 2 that's larger than size of S and every i (0<= i < size of S), we will sort all substring of S that starts from i and they're length is equal 2^j in O(nlgn).
consider (i, j) a substring of S that starts from i and it's length is equal 2^j
in each step(for every j) we spot a number from 0 to n-1 for every substring (i, j), that it's position in all substrings (i, j). we call this number D[i][j]
we can calculate D[i][j+1] in this way :
1 . for every i : D[i][j + 1] = (D[i][j] * n) + D[i + 2^j][j]
2 . sort all D[i][j + 1], and then change value's to numbers from 0 to n-1 (as explained above).
the total complexity is equal O(nlgn * lgn).
I know there's a O(nlgn) algorithm but I have no idea for that one :D