Conversation
BWT/BWT/Tests.cs
Outdated
Comment on lines
1
to
2
| namespace BWT | ||
| { |
There was a problem hiding this comment.
Используйте file-scoped namespaces
Suggested change
| namespace BWT | |
| { | |
| namespace BWT; |
Comment on lines
41
to
42
|
|
||
| } |
BWT/BWT/BWTAlgorithm.cs
Outdated
| @@ -0,0 +1,47 @@ | |||
| namespace BWT | |||
There was a problem hiding this comment.
Здесь тоже нужен file-scoped namespace
И using вниз уехал
BWT/BWT/BWTAlgorithm.cs
Outdated
| namespace BWT | ||
| { | ||
| using System.Text; | ||
| public class BWTAlgorithm |
There was a problem hiding this comment.
Если класс только static-методы содержит, его тоже можно отметить как static
BWT/BWT/BWTAlgorithm.cs
Outdated
|
|
||
| for (int i = 0; i < lengthOfString; ++i) | ||
| { | ||
| rotations[i] = input.Substring(i) + input.Substring(0, i); |
There was a problem hiding this comment.
В последнем .net можно вместо Substring использовать оператор диапазона, то есть
Suggested change
| rotations[i] = input.Substring(i) + input.Substring(0, i); | |
| rotations[i] = input[i..] + input[..i]; |
BWT/BWT/BWTAlgorithm.cs
Outdated
| using System.Text; | ||
| public class BWTAlgorithm | ||
| { | ||
| public static (string, int) FrontBWT(string input) |
There was a problem hiding this comment.
Типы кортежа по стайлгайду надо именовать, с большой буквы
Suggested change
| public static (string, int) FrontBWT(string input) | |
| public static (string ..., int ...) FrontBWT(string input) |
BWT/BWT/BWTAlgorithm.cs
Outdated
|
|
||
| Array.Sort(rotations); | ||
|
|
||
| string transformed = new string(rotations.Select(s => s[lengthOfString - 1]).ToArray()); |
There was a problem hiding this comment.
Чтобы взять первый элемент с конца строки, начиная с C# 8 можно писать так
Suggested change
| string transformed = new string(rotations.Select(s => s[lengthOfString - 1]).ToArray()); | |
| string transformed = new string(rotations.Select(s => s[^1]).ToArray()); |
BWT/BWT/BWTAlgorithm.cs
Outdated
| Array.Sort(rotations); | ||
|
|
||
| string transformed = new string(rotations.Select(s => s[lengthOfString - 1]).ToArray()); | ||
| int bwtIndex = Array.IndexOf(rotations, input); |
There was a problem hiding this comment.
Suggested change
| int bwtIndex = Array.IndexOf(rotations, input); | |
| var bwtIndex = Array.IndexOf(rotations, input); |
| @@ -0,0 +1,41 @@ | |||
| using System; | |||
BWT/BWT/BWTAlgorithm.cs
Outdated
| { | ||
| int lengthOfBWTString = bwtString.Length; | ||
|
|
||
| string[] table = new string[lengthOfBWTString]; |
There was a problem hiding this comment.
Suggested change
| string[] table = new string[lengthOfBWTString]; | |
| var table = new string[lengthOfBWTString]; |
BWT/BWT/BWTAlgorithm.cs
Outdated
|
|
||
| public static class BWTAlgorithm | ||
| { | ||
| public static (string, int) FrontBWT(string input) |
There was a problem hiding this comment.
Suggested change
| public static (string, int) FrontBWT(string input) | |
| public static (string TransformedString, int EndPosition) FrontBWT(string input) |
Например
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.