-
Notifications
You must be signed in to change notification settings - Fork 0
Hw1 bwt #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Hw1 bwt #2
Conversation
hw1BWT/hw1BWT/BWT.cs
Outdated
| } | ||
| string oldString1 = ReverseBWT("cbaab", numberOfString); | ||
| return (oldString1 == string1); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Надо пустые строки между методами, и между свойствами/полями и методами, и т.д.
hw1BWT/hw1BWT/BWT.cs
Outdated
| return false; | ||
| } | ||
| string oldString1 = ReverseBWT("cbaab", numberOfString); | ||
| return (oldString1 == string1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
А тут скобки не обязательны
hw1BWT/hw1BWT/BWT.cs
Outdated
| { | ||
| table[i, j] = table[i - 1, j - 1]; | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Явное построение таблицы вращений лишает надежды на ещё один балл за "продвинутость" алгоритма.
| 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
static
hw1BWT/hw1BWT/BWT.cs
Outdated
| alphabet += str[i]; | ||
| } | ||
| } | ||
| char[] alphaberArray = alphabet.ToCharArray(0, alphabet.Length); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Опечатка :)
yurii-litvinov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Теперь алгоритм прямого преобразования не наивный, но реализован так, что всё равно будет работать не очень :)
| return suffixArray; | ||
| } | ||
|
|
||
| public static Tuple<string, int> BWTtransform(string str) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Substring каждый раз создаёт новую строку, так что это может быть очень серьёзным ударом по потребляемой памяти. Тут лучше было руками написать "циклическое сравнение с заданного индекса"
| suffixArray[j + 1] = swaper; | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
И потом, квадратичная сортировка тут может быть не очень, потому что строки бывают длинные. В идеале надо было реализовать свой IComparer и воспользоваться библиотечным Array.Sort, передав ему компаратор.
No description provided.