Skip to content

Conversation

@MikePuzanov
Copy link
Owner

No description provided.

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.

Комментарии к коммитам ужасны :) И CI ругается, что тесты не проходят (потому что многопоточный вариант не работает, потому что Вы забыли Task.WhenAll или что-нибудь вроде.


<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Все уже на .NET 6 перешли

Количество повторов: 1000.
Паралельная сортировка:
Матожидание = 0,005
Среднеквадратичное отклонение = 0,1580348062927937
Copy link
Collaborator

Choose a reason for hiding this comment

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

Среднеквадратичное отклонение на два порядка больше матожидания, это не нормально

Результаты на массивах размером 1000.
Количество повторов: 1000.
Паралельная сортировка:
Матожидание = 0,005
Copy link
Collaborator

Choose a reason for hiding this comment

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

Надо указывать размерность величин

{
array[i] = rand.Next(100);
}
var array1 = array;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Это не понадобилось, да и в принципе создавать ещё одну ссылку на тот же массив не уверен, что может быть тут полезно


namespace QSort
{
public class QSort<T> where T:IComparable
Copy link
Collaborator

Choose a reason for hiding this comment

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

Нужны комментарии


namespace QSort
{
public class QSort<T> where T:IComparable
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
public class QSort<T> where T:IComparable
public class QSort<T> where T: IComparable

{
public class QSort<T> where T:IComparable
{
private IList<T> List;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
private IList<T> List;
private IList<T> list;

camelCase же. Если Вы и HwProj так пишете, мы все обречены :)

Comment on lines +65 to +66
task[0] = Task.Run(() => SortCallMulti(start, partition - 1));
task[1] = Task.Run(() => SortCallMulti(partition + 1, end));
Copy link
Collaborator

Choose a reason for hiding this comment

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

А что с ними потом происходит? Их никто не ждёт, их никто не хранит даже. Мы просто тут пожелали, чтобы когда-нибудь эти лямбды отработали, и всё :)

{
public class Statistics
{
public static void CollectStatisticsFromMatrix(int lenght, int count)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Думаю, что это уже не матрица. И lenght пишется как length

private static int[] GenerateArray(int lenght)
{
var array = new int[lenght];
var random = new Random();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Создавать тысячу Random-ов может быть плохой идеей по двум причинам:

  • они все делают одно и то же, а память жрут
  • Random инициализируется текущим временем в миллисекундах от начала Эпохи, так что если в одну миллисекунду GenerateArray вызвался дважды, он сгенерит два одинаковых массива

Лучше создать его один раз и передавать сюда.

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