From 675e404106fb188ba544f69ee806808b400233df Mon Sep 17 00:00:00 2001 From: zscoder Date: Thu, 6 Oct 2016 22:12:24 +0800 Subject: [PATCH] Updated SA (bug fix) --- Data Structures Class Template.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Data Structures Class Template.cpp b/Data Structures Class Template.cpp index eb955a3..3780537 100644 --- a/Data Structures Class Template.cpp +++ b/Data Structures Class Template.cpp @@ -878,7 +878,7 @@ int cmp(suffix a, suffix b) return (a.rank[0] == b.rank[0])? (a.rank[1] < b.rank[1] ?1: 0):(a.rank[0] < b.rank[0] ?1: 0); } -struct SuffixLCPArray //mostly/all from geeksforgeeks +struct SuffixLCPArray //mostly/all from geeksforgeeks, to work for general alphabet remove the - 'a' { vector suffixes; vi suffixArr; @@ -888,7 +888,7 @@ struct SuffixLCPArray //mostly/all from geeksforgeeks int n = txt.length(); // A structure to store suffixes and their indexes - suffixes.resize(n+1); + suffixes.resize(n); // Store suffixes and their indexes in an array of structures. // The structure is needed to sort the suffixes alphabatically // and maintain their old indexes while sorting