Skip to content

Inverted singly linked list#56

Open
MinyazevR wants to merge 5 commits intomainfrom
invertedSinglyLinkedList
Open

Inverted singly linked list#56
MinyazevR wants to merge 5 commits intomainfrom
invertedSinglyLinkedList

Conversation

@MinyazevR
Copy link
Copy Markdown
Owner

No description provided.

Comment thread List/List/List.h
INSUFFICIENT_MEMORY,
ELEMENT_IS_MISSING,
POSITION_FOUND
} Error;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍

#pragma once
#include "../../List/List/List.h"

List* invertList(List* list); No newline at end of file
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Надо комментарии

List* newList = createList();
Error error = NOT_ERROR;
Position* firstPosition = first(list, &error);
int* arrayOfElements = calloc(returnSize(list) + 1, sizeof(int));
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Нууу, так, конечно, можно, но на больших тестах упадёт с OutOfMemory. Хотелось всё-таки чисто через списки сделать

return -1;
}
List* newList = createList();
deleteList(newList);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Хм, что?

}
add(list, temporary, &error);
}
fclose(file);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Можно было функцию чтения из файла переиспользовать

}
fclose(file);
invertList(list);
const int array[5] = {10, 40 , 30 , 20};
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
const int array[5] = {10, 40 , 30 , 20};
const int array[5] = {10, 40, 30, 20};

for (int i = 0; i < returnSize(list); i++)
{
const int value = arrayOfElements[i];
replaceValue(secondPosition, value);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

У меня такого нет, не компилится

@@ -0,0 +1,4 @@
#pragma once
#include "../../List/List/List.h"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

И List не по такому пути лежит

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