Skip to content

Advanced bracket balance. Kalsina Yana.#7

Open
yaprogrammer18-yanchi wants to merge 23 commits into
mainfrom
bracket_balance_task_branch
Open

Advanced bracket balance. Kalsina Yana.#7
yaprogrammer18-yanchi wants to merge 23 commits into
mainfrom
bracket_balance_task_branch

Conversation

@yaprogrammer18-yanchi

Copy link
Copy Markdown
Owner

Добавила файл к домашней работе "Продвинутый баланс скобок". Здесь три файла:

  • файл с решением задачи
  • файл с реализацией стека
  • файл с объявлениями структур и функций стека
    последние два файла изначально были созданы на ветке стека.

@WoWaster WoWaster left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Со стилем всё ещё беды :( При том если в стеке минимум косяков, то вот в балансе что-то как-то всё плохо.

Comment thread src/AdvancedBracketBalance/stack.h Outdated
Comment thread src/AdvancedBracketBalance/stack.h Outdated
Comment thread src/AdvancedBracketBalance/stack.c Outdated
Comment thread src/AdvancedBracketBalance/stack.c Outdated
Comment thread .gitignore Outdated
Comment thread src/AdvancedBracketBalance/advancedBracketBalance.c Outdated
Comment thread src/AdvancedBracketBalance/advancedBracketBalance.c Outdated
Comment thread src/AdvancedBracketBalance/advancedBracketBalance.c Outdated
Comment thread src/AdvancedBracketBalance/advancedBracketBalance.c Outdated
Comment thread src/AdvancedBracketBalance/advancedBracketBalance.c
Comment thread src/AdvancedBracketBalance/stack.c

@WoWaster WoWaster left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Совсем косметика и будет хорошо.

Comment thread .gitignore Outdated
*.pdb

# Kernel Module Compile Results
# Kernel Module Comspile Results

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

????

char tmp = ' ';
int length = strlen(stringWithBrackets);
for (int i = 0; i < length; i++) {
tmp = stringWithBrackets[i];

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Безопаснее делать так:

Suggested change
tmp = stringWithBrackets[i];
char ch = stringWithBrackets[i];

Чтобы переменная не была общей между итерациями цикла.
Ну и название tmp прям совсем не информативно. ch не сказать, что шибко лучше, но хотя бы понятно, что это некий символ

Comment on lines +29 to +31
else if ((tmp == ')' || tmp == '}' || tmp == ']') && (isEmpty(stack))) {
isBalanced = false;
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
else if ((tmp == ')' || tmp == '}' || tmp == ']') && (isEmpty(stack))) {
isBalanced = false;
}
else if ((tmp == ')' || tmp == '}' || tmp == ']') && (isEmpty(stack))) {
isBalanced = false;
break;
}

?

@WoWaster WoWaster left a comment

Copy link
Copy Markdown
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