Skip to content

KR2SortTree - #17

Open
Palezehvat wants to merge 1 commit into
mainfrom
sortTree
Open

Palezehvat wants to merge 1 commit into
mainfrom
sortTree

Conversation

@Palezehvat

Copy link
Copy Markdown
Owner

No description provided.

Comment thread sortTree/sortTree/main.c
for (int i = 0; i < size; ++i) {
printf("%d ", arrayOut[i]);
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Память не удаляется

Comment thread sortTree/sortTree/tree.c
}
}

int j = 0;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

О, глобальная переменная, минус два балла :) Надо было передавать как параметр по указателю везде, где она нужна.

Comment thread sortTree/sortTree/tree.h

#include <stdbool.h>

typedef struct Node Node;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Это тут, к сожалению, не нужно, потому что этот модуль буквально ничего про tree внешнему миру не предоставляет

Comment thread sortTree/sortTree/tree.h

typedef struct Node Node;

void addArrayToTree(int arrayOut[], int size);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Неудачное название функции. Она не добавляет массив в дерево, она сортирует массив

Comment thread sortTree/sortTree/tree.c
Comment on lines +17 to +18
Tree* tree = calloc(1, sizeof(tree));
return tree;

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
Tree* tree = calloc(1, sizeof(tree));
return tree;
return calloc(1, sizeof(tree));

Comment thread sortTree/sortTree/tree.c

void addToTree(Tree* tree, int value) {
if (tree == NULL) {
return ;

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
return ;
return;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Но ещё надо бы как-то просигнализировать вызывающему, что всё плохо

Comment thread sortTree/sortTree/tree.c

void backOrderClear(Tree* tree) {
helpBackOrderClear(tree->root);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Само tree ещё не удаляется

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.

3 participants