Skip to content

Comments

Переписывание контрольной №1. Кальсина Яна#17

Open
yaprogrammer18-yanchi wants to merge 6 commits intomainfrom
testRewriteBranch
Open

Переписывание контрольной №1. Кальсина Яна#17
yaprogrammer18-yanchi wants to merge 6 commits intomainfrom
testRewriteBranch

Conversation

@yaprogrammer18-yanchi
Copy link
Owner

Добавила решения второй и третьей задач. Тесты все прописаны в самих исходных файлах.

Copy link
Collaborator

@WoWaster WoWaster left a comment

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 +29 to +35
/*
* функция удаления элемента по индексу
* принимает указатель на список и индекс элемента
* возвращает булевое значние, сообщающее, удачно ли прошла операция
* внутри себя освобождает память удаляемого элемента
*/
bool removeElement(List* list, int 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 +45 to +52
/*
* функция вывода списка в консоль
* принимает только указаетль на список
* ничего не возвращает
* печатает элементы списка через пробел
* в случае переданного пустого или несуществующего списка сообщает об этом пользователю
*/
void printList(List* list);
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 +70 to +74
* функция проверки, один ли элемент в списке
* возвращает true если да, false, если нет
* на вход принимает указатель на список
*/
bool oneElement(List* list);
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 +52 to +53
if (list == NULL || isEmpty(list) || index < 0)
return -1;
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 +154 to +178
List* reverse(List* list)
{
if (list == NULL || isEmpty(list)) {
return NULL;
}

List* newOneList = newList();
copy(list, newOneList);

if (newOneList == NULL || isEmpty(newOneList)) {
return NULL;
}
ListNode* prev = NULL;
ListNode* current = newOneList->head;
ListNode* next = NULL;

while (current != NULL) {
next = current->next;
current->next = prev;
prev = current;
current = next;
}
newOneList->head = prev;
return newOneList;
}
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 +192 to +193
deleteList(newOne1);
return false;
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 +133 to +143
if (argc == 2 && strcmp(argv[1], "--test") == 0) {
bool allTestsPassed = tests();
if (allTestsPassed) {
printf("Все тесты прошли успешно");
} else {
printf("Некоторые тесты не были пройдены");
}
printf("\n");
return 0;
}
return 0;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Забавно, что здесь Вы решили попробовать посмотреть в аргументы, а в другой задаче нет. (в 3 задаче даже правильнее)

Comment on lines +64 to +71
for (int i = 1; i < length; i++) {
if (arr[i] != 0) {
int temp = arr[0];
arr[0] = arr[i];
arr[i] = temp;
break;
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Да блин, почему Вы решили, что нули надо использовать. Я говорил ровно обратное

return result;
}

int getMinNumberFromDigits(unsigned num, int length)
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