Блог пользователя DNR

Автор DNR, 3 часа назад, По-английски

While the usual $$$O(n \log{n})$$$ suffix array algorithm described here suffices for almost all of one's competitive-programming needs, suffix structures turn out to be useful in several other fields which require faster algorithms. Many of the fastest algorithms that see real-world use today are derivatives of an $$$O(n)$$$ algorithm called SA-IS ("Suffix Array by Induced Sorting"). Perhaps more interestingly to users here, the fastest suffix array implementation on Library Checker as of now uses SA-IS (although adamant seems to get close using an over-engineered suffix automaton), and the Atcoder Library also happens to use it.

Unfortunately, this algorithm is really annoying to understand (it has a lot of finicky details and seemingly independent yet interdependent parts), and is definitely not like the short and elegant algorithms we're used to in competitive programming. I couldn't find any good explanations online (i.e. explanations that are both semi-rigorous and motivated), and had to resort to reading the original paper. This wasn't a particularly enjoyable experience.

I've tried to write an exposition that's hopefully better than what currently exists, and it can be found here: https://www.welcome-to-the-sunny-side.com/algo/theory/sais.html

It ended up being quite long, but due to how annoying this algorithm is, I think one has to compromise on at least one of {rigour, motivation, length}.

  • Проголосовать: нравится
  • +15
  • Проголосовать: не нравится