Conversation
hw1BWT/hw1BWT/BWT.cs
Outdated
| } | ||
| string oldString1 = ReverseBWT("cbaab", numberOfString); | ||
| return (oldString1 == string1); | ||
| } |
There was a problem hiding this comment.
Надо пустые строки между методами, и между свойствами/полями и методами, и т.д.
hw1BWT/hw1BWT/BWT.cs
Outdated
| return false; | ||
| } | ||
| string oldString1 = ReverseBWT("cbaab", numberOfString); | ||
| return (oldString1 == string1); |
There was a problem hiding this comment.
А тут скобки не обязательны
hw1BWT/hw1BWT/BWT.cs
Outdated
| { | ||
| table[i, j] = table[i - 1, j - 1]; | ||
| } | ||
| } |
There was a problem hiding this comment.
Явное построение таблицы вращений лишает надежды на ещё один балл за "продвинутость" алгоритма.
| numberOfStr = i; | ||
| break; | ||
| } | ||
| } |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
hw1BWT/hw1BWT/BWT.cs
Outdated
|
|
||
| namespace hw1BWT | ||
| { | ||
| class BWT |
hw1BWT/hw1BWT/BWT.cs
Outdated
| alphabet += str[i]; | ||
| } | ||
| } | ||
| char[] alphaberArray = alphabet.ToCharArray(0, alphabet.Length); |
yurii-litvinov
left a comment
There was a problem hiding this comment.
Теперь алгоритм прямого преобразования не наивный, но реализован так, что всё равно будет работать не очень :)
| return suffixArray; | ||
| } | ||
|
|
||
| public static Tuple<string, int> BWTtransform(string str) |
There was a problem hiding this comment.
BWTTransform, или BwtTransform, в CamelCase каждое слово должно быть с заглавной
| for (int j = 0; j < suffixArray.Length - i; j++) | ||
| { | ||
| string str1 = str.Substring(suffixArray[j]) + str.Substring(0, suffixArray[j]); | ||
| string str2 = str.Substring(suffixArray[j + 1]) + str.Substring(0, suffixArray[j + 1]); |
There was a problem hiding this comment.
Substring каждый раз создаёт новую строку, так что это может быть очень серьёзным ударом по потребляемой памяти. Тут лучше было руками написать "циклическое сравнение с заданного индекса"
| suffixArray[j + 1] = swaper; | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
И потом, квадратичная сортировка тут может быть не очень, потому что строки бывают длинные. В идеале надо было реализовать свой IComparer и воспользоваться библиотечным Array.Sort, передав ему компаратор.
No description provided.