Conversation
| int numbers[1000] = { 0 }; | ||
| int counts[1000] = { 0 }; |
There was a problem hiding this comment.
О таком пользователю явно стоит говорить
| int i = 0; | ||
| int j = 0; |
There was a problem hiding this comment.
А зачем эти переменные здесь? Что мешает объявить их в заголовке for?
| numbers[size] = input; | ||
| counts[size] = 1; | ||
| size++; |
There was a problem hiding this comment.
Ой, то есть size может стать больше 1000 и мы будем писать чёрт знает куда :(
| 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; | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Интересная идея с двойной сортировкой. Но лучше было бы вынести это в отдельную функцию
There was a problem hiding this comment.
Ой, а зачем тут бинарик?
| for (index = 0; index < arraySize; index++) { | ||
| if (digitsArray[index] != 0) { | ||
| resultNumber = resultNumber * 10 + digitsArray[index]; | ||
| } | ||
| } |
| if (!node) { | ||
| printf("error\n"); | ||
| } |
| Node* push(Node* head, int value) | ||
| { | ||
| Node* node = newNode(value); | ||
| node->next = head; |
There was a problem hiding this comment.
И даже value не положили
| current = next; | ||
| } | ||
|
|
||
| return prev; |
There was a problem hiding this comment.
По сути да, но как-то грустно, что старый head всё ещё можно использовать
| return prev; | ||
| } | ||
|
|
||
| void free(Node* head) |
There was a problem hiding this comment.
Плохая идея заводить функцию с дублирующимся именем
Шалахина Анна