Skip to content

Conversation

@MikePuzanov
Copy link
Owner

No description provided.

}
string oldString1 = ReverseBWT("cbaab", numberOfString);
return (oldString1 == string1);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Надо пустые строки между методами, и между свойствами/полями и методами, и т.д.

return false;
}
string oldString1 = ReverseBWT("cbaab", numberOfString);
return (oldString1 == string1);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А тут скобки не обязательны

{
table[i, j] = table[i - 1, j - 1];
}
}
Copy link
Collaborator

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.


namespace hw1BWT
{
class BWT
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

static

alphabet += str[i];
}
}
char[] alphaberArray = alphabet.ToCharArray(0, alphabet.Length);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Опечатка :)

Copy link
Collaborator

@yurii-litvinov yurii-litvinov left a 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)
Copy link
Collaborator

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]);
Copy link
Collaborator

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;
}
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

И потом, квадратичная сортировка тут может быть не очень, потому что строки бывают длинные. В идеале надо было реализовать свой IComparer и воспользоваться библиотечным Array.Sort, передав ему компаратор.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants