Conversation
src/optimalSortingDir/sort.c
Outdated
|
|
||
| int sort(int *list, int length) { | ||
|
|
||
| int *rememberList = |
There was a problem hiding this comment.
| int *rememberList = | |
| int *unsortedList = |
src/optimalSortingDir/sort.c
Outdated
| for (int i = 0; i < length; i++) { | ||
| for (int j = 0; j < length - 1 - i; j++) { | ||
| if (list[j] > list[j + 1]) { | ||
| int helpingVar = list[j]; |
src/optimalSortingDir/sort.c
Outdated
| #include "sort.h" | ||
| #include <stdlib.h> | ||
|
|
||
| int sort(int *list, int length) { |
There was a problem hiding this comment.
Как-то у Вас расположение звёздочек между файлами гуляет.
src/optimalSortingDir/main.c
Outdated
|
|
||
| int main() { | ||
|
|
||
| int *onlyNumbersList = calloc(200, sizeof(int)); |
There was a problem hiding this comment.
Зачем 200, если разговор был про 100 в задаче?
src/optimalSortingDir/main.c
Outdated
| { | ||
| onlyNumbersList[length++] = inputNumber; // добавляем число в список | ||
| } | ||
|
|
src/optimalSortingDir/sort.c
Outdated
| int *unsortedArray = | ||
| calloc(length, sizeof(int)); // c помощью этого списка будем счиатать | ||
| // элементы, изменившие свою позицию | ||
| for (int i = 0; i < length; i++) { | ||
| unsortedArray[i] = array[i]; | ||
| } |
There was a problem hiding this comment.
Пишите комментарии над сущностью, а не под ней или за ней.
src/optimalSortingDir/main.c
Outdated
|
|
||
| int main() { | ||
|
|
||
| int *ArrayWithNumbers = calloc(100, sizeof(int)); |
There was a problem hiding this comment.
Тут надо с маленькой буквы
src/optimalSortingDir/main.c
Outdated
| } else { | ||
| return 1; | ||
| } | ||
| nextSymbol = getchar(); // читаем символ, который был введен дальше |
There was a problem hiding this comment.
По условию требовали использовать только scanf().
src/optimalSortingDir/sort.c
Outdated
| for (int i = 0; i < length; i++) { | ||
| unsortedArray[i] = array[i]; | ||
| } |
There was a problem hiding this comment.
Это можно заменить на memcpy
WoWaster
left a comment
There was a problem hiding this comment.
Я не понял, как я не заметил этого в прошлый раз, но тут явно беды с форматированием (2 пробела вместе 4, скобочки у функций должны быть на новой строке).
Проверьте, пожалуйста, что Вы запускаете clang-format из директории, где явно лежит файл .clang-format с настройками для WebKit (смотреть через ls -a, потому что по умолчанию его может быть не видно).
В папке optimalSortingDir разместила все файлы для сборки приложения. Сортировку писала пузырьком, реализацию сортировки оптимизировала с помощью О2.