private void BoundarySuffixesProcess(char sym) { HashedSet <int> newBoundarySuffix = new HashedSet <int>(); foreach (int boundIdx in boundarySuffix) { int idx = array.GetInverse(boundIdx); char c = stringBuilder[lcp[idx] + array[idx + 1]]; if (sym < c) { } else if (sym == c) { lcp[idx]++; newBoundarySuffix.Add(boundIdx); } else { MoveSuffix(sym, boundIdx, idx, newBoundarySuffix); } } UpdateBoundarySuffixes(newBoundarySuffix); }
public void AddCharAtBegin(char ch) { if (StreamString.Length == 0) { Array.Insert(0, 0); StreamString.AddCharAtBegging(ch); return; } int pos = Array.GetInverse(StreamString.Length - 1); InvertedSuffixArrayInsertSearchStrategy strategy = new InvertedSuffixArrayInsertSearchStrategy(this, pos, ch); int first = global::SuffixArray.BinarySearch.BinarySearch.Instance.BinarySearchFirst(0, StreamString.Length, strategy); Array.Insert(first, StreamString.Length); StreamString.AddCharAtBegging(ch); }
private static bool EqInverseTreap(IInverseIntTreap <int> fstTreap, IInverseIntTreap <int> sndTreap) { if (fstTreap.Count != sndTreap.Count) { return(false); } for (int i = 0; i < fstTreap.Count; i++) { if (fstTreap[i] != sndTreap[i]) { return(false); } if (fstTreap.GetInverse(i + 1) != sndTreap.GetInverse(i + 1)) { return(false); } } return(true); }