Skip to content

Comments

Контрольная работа(3)#12

Open
shannami wants to merge 3 commits intomainfrom
controlTest3
Open

Контрольная работа(3)#12
shannami wants to merge 3 commits intomainfrom
controlTest3

Conversation

@shannami
Copy link
Owner

Шалахина Анна

@shannami shannami requested a review from WoWaster December 11, 2025 15:16
Comment on lines +5 to +6
int numbers[1000] = { 0 };
int counts[1000] = { 0 };
Copy link
Collaborator

Choose a reason for hiding this comment

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

О таком пользователю явно стоит говорить

Comment on lines +9 to +10
int i = 0;
int j = 0;
Copy link
Collaborator

Choose a reason for hiding this comment

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

А зачем эти переменные здесь? Что мешает объявить их в заголовке for?

Comment on lines +33 to +35
numbers[size] = input;
counts[size] = 1;
size++;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ой, то есть size может стать больше 1000 и мы будем писать чёрт знает куда :(

Comment on lines +39 to +51
for (i = 0; i < size - 1; i++) {
for (j = 0; j < size - i - 1; j++) {
if (numbers[j] > numbers[j + 1]) {
int tempNum = numbers[j];
numbers[j] = numbers[j + 1];
numbers[j + 1] = tempNum;

int temp = counts[j];
counts[j] = counts[j + 1];
counts[j + 1] = temp;
}
}
}
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

Choose a reason for hiding this comment

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

Ой, а зачем тут бинарик?

Comment on lines +68 to +72
for (index = 0; index < arraySize; index++) {
if (digitsArray[index] != 0) {
resultNumber = resultNumber * 10 + digitsArray[index];
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Вах! Логика правильная

Comment on lines +12 to +14
if (!node) {
printf("error\n");
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Очень плохая идея.

Node* push(Node* head, int value)
{
Node* node = newNode(value);
node->next = head;
Copy link
Collaborator

Choose a reason for hiding this comment

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

И даже value не положили

current = next;
}

return prev;
Copy link
Collaborator

Choose a reason for hiding this comment

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

По сути да, но как-то грустно, что старый head всё ещё можно использовать

return prev;
}

void free(Node* head)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Плохая идея заводить функцию с дублирующимся именем

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.

2 participants