Skip to content

Commit 47c07ff

Browse files
committed
fixed the algorithm LZ77
1 parent ae7444f commit 47c07ff

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

AlgorithmsLibrary/LZ77Algm/LZ77Algm.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ public static IAlgmEncoded<List<CodeBlock>> Encode(string inputString)
7171
establishingBuffer.Append('$');
7272
char nextChar = establishingBuffer[currentLengthSubString];
7373

74-
string subInEstablish = establishingBuffer.Substring(0, currentLengthSubString + 1);
75-
establishingBuffer.Remove(0, length + 1);
74+
string subInEstablish = establishingBuffer.Substring(0, currentLengthSubString);
75+
establishingBuffer.Remove(0, length);
7676
searchBuffer.Append(subInEstablish);
7777

7878
var codeblock = new CodeBlock(offset, length, nextChar);
@@ -154,6 +154,7 @@ public static IAlgmEncoded<string> Decode(string encodedString)
154154
int start = resultDecoding.Length - codeBlock.Offset;
155155
for (int i = 0; i <= codeBlock.Length - 1; i++)
156156
resultDecoding.Append(resultDecoding[start + i]);
157+
continue;
157158
}
158159
resultDecoding.Append(codeBlock.NextChar);
159160
}

0 commit comments

Comments
 (0)