From 5cd5460b57e8218eba1b9c1906ab87599e1fd982 Mon Sep 17 00:00:00 2001 From: Dao Le Bao Minh Date: Tue, 2 May 2023 22:42:50 +0700 Subject: [PATCH] Update suffix-array.md small typo needs to be fixed --- src/string/suffix-array.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/string/suffix-array.md b/src/string/suffix-array.md index c7d7fc2cb..63170e9e4 100644 --- a/src/string/suffix-array.md +++ b/src/string/suffix-array.md @@ -376,7 +376,7 @@ Thus we will not overlook any by accident. Because the suffixes are sorted, it is clear that the current suffix $p[i]$ will give new substrings for all its prefixes, except for the prefixes that coincide with the suffix $p[i-1]$. Thus, all its prefixes except the first $\text{lcp}[i-1]$ one. -Since the length of the current suffix is $n - p[i]$, $n - p[i] - \text{lcp}[i-1]$ new suffixes start at $p[i]$. +Since the length of the current suffix is $n - p[i]$, $n - p[i] - \text{lcp}[i-1]$ new prefixes start at $p[i]$. Summing over all the suffixes, we get the final answer: $$\sum_{i=0}^{n-1} (n - p[i]) - \sum_{i=0}^{n-2} \text{lcp}[i] = \frac{n^2 + n}{2} - \sum_{i=0}^{n-2} \text{lcp}[i]$$ pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy