Conversation
task_02/src/stack.hpp
Outdated
|
|
||
| #include <stack> | ||
| #include <vector> | ||
| struct Node { |
There was a problem hiding this comment.
лучше перенести эту структуру в сам класс стека
task_02/src/stack.hpp
Outdated
|
|
||
| class Stack { | ||
| public: | ||
| struct Stack { |
There was a problem hiding this comment.
и тут лучше все-таки класс применить и наружу не светить Node, если исправишь будет чуть больше баллов за д.з.
task_04/src/heap.cpp
Outdated
|
|
||
| void Heap::SiftDown(int index) { | ||
| while (2 * index + 1 < heap_.size()) { | ||
| int l = 2 * index + 1, r = 2 * index + 2; |
There was a problem hiding this comment.
давай 1 объявление 1 строчка?
task_05/src/qsort.hpp
Outdated
| #include <vector> | ||
|
|
||
| template <typename T> | ||
| int Partition(std::vector<T>& arr, int l, int r) { |
There was a problem hiding this comment.
можно унести в lib/src/util.hpp уберем дублирование кода)
There was a problem hiding this comment.
добавил бы ещё тест с пустым деревом и попыткой удаления
task_02/src/stack.cpp
Outdated
| data_.pop(); | ||
| return result; | ||
| Node* t = this->top_; | ||
| this->top_ = this->top_->prev_; |
There was a problem hiding this comment.
давай не будем использовать тут this, только усложняет чтение
task_02/src/stack.hpp
Outdated
|
|
||
| private: | ||
| std::stack<int> data_; | ||
| Node* Top(); |
There was a problem hiding this comment.
Node это приватный тип, а Top публичный метод, довольно странно
task_02/src/stack.hpp
Outdated
|
|
||
| private: | ||
| std::vector<int> data_; | ||
| Stack s_; |
There was a problem hiding this comment.
давай сделаем их приватными полями
There was a problem hiding this comment.
давай еще нормальные имена дадим, не однобуквенные
task_04/src/heap.cpp
Outdated
|
|
||
| void Heap::SiftDown(int index) { | ||
| while (2 * index + 1 < heap_.size()) { | ||
| int l = 2 * index + 1; |
There was a problem hiding this comment.
давай по длинее имена переменных сделаем: left
task_04/src/heap.cpp
Outdated
| while (2 * index + 1 < heap_.size()) { | ||
| int l = 2 * index + 1; | ||
| int r = 2 * index + 2; | ||
| int j = l; |
There was a problem hiding this comment.
и тут j не понятно что за переменная
task_05/src/qsort.hpp
Outdated
| #include <iostream> | ||
| #include <vector> | ||
|
|
||
| #include "../../lib/src/util.hpp" |
There was a problem hiding this comment.
а просто #include <util.hpp> не работает?
| #include <vector> | ||
|
|
||
| template <class T> | ||
| int Partition(std::vector<T>& data, int l, int r) { |
There was a problem hiding this comment.
а из util.hpp не получится использовать?
task_06/src/order_stats.hpp
Outdated
| template <class T> | ||
| int Partition(std::vector<T>& data, int l, int r) { | ||
| std::srand(std::time(nullptr)); | ||
| int pivotPos = l + std::rand() % (r - l); |
There was a problem hiding this comment.
по всему файлу: Node* n давай как-то не так коротко назовем?
task_02/src/stack.hpp
Outdated
|
|
||
| private: | ||
| std::vector<int> data_; | ||
| Stack s_; |
There was a problem hiding this comment.
давай еще нормальные имена дадим, не однобуквенные
| ASSERT_EQ(TempUpDayCounter(std::vector<int>{5, 12, 4, 9, 5, 4, 2}), | ||
| (std::vector<int>{1, 0, 1, 0, 0, 0, 0})); | ||
| ASSERT_EQ(TempUpDayCounter(std::vector<int>{2, 6, 17, 7, 3, 4}), | ||
| (std::vector<int>{1, 1, 0, 0, 1, 0})); |
There was a problem hiding this comment.
везде в ответах 0 или 1 давай еще добавим еще каких-нибудь чисел)
task_04/src/heap.cpp
Outdated
| #include <vector> | ||
|
|
||
| void Heap::SiftUp(int index) { | ||
| while (heap_[index] < heap_[(index - 1) / 2]) { |
There was a problem hiding this comment.
я бы добавил еще index != 0
что бы было явно понятно что в отрицательные числа не пойдем (можно просто index > 0 еще более явно)
No description provided.