Skip to content

Task 1#20

Open
MRyabchikov wants to merge 14 commits intoAlgorithmsDafeMipt2024:mainfrom
MRyabchikov:main
Open

Task 1#20
MRyabchikov wants to merge 14 commits intoAlgorithmsDafeMipt2024:mainfrom
MRyabchikov:main

Conversation

@MRyabchikov
Copy link
Copy Markdown

No description provided.

Comment thread task_02/src/stack.hpp Outdated
: data(_data), prevptr(_prev) {}
StackNode() : data(), prevptr(nullptr) {}
T data;
StackNode<T> *prevptr;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

prev_ptr

Comment thread task_02/src/stack.hpp Outdated
int Pop();
Stack() : top(nullptr), size(0) {}
void push(T value);
T pop();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pop

Comment thread task_02/src/stack.hpp Outdated
void push(T value);
T pop();
T getTop();
int getSize();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

GetSize

Comment thread task_02/src/stack.hpp Outdated
Stack() : top(nullptr), size(0) {}
void push(T value);
T pop();
T getTop();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

GetTop

Comment thread task_02/src/stack.hpp Outdated

private:
std::stack<int> data_;
StackNode<T> *top;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

top_

Comment thread task_05/src/test.cpp
Comment thread task_05/src/test.cpp Outdated
TEST(quickSort, Simple) {
std::vector<int> data = {1, 2, 3, 4, 5};
quickSort<int>(data);
for (auto curr : data) std::cout << curr << " ";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

это лишнее для теста

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Ой, да, это рудимент какой-то

Comment thread task_06/src/test.cpp
Comment thread task_07/src/BinaryTree.hpp Outdated
template <class T>
class BinaryTree {
public:
BinaryTree() : root(nullptr) {}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

тут виже только обычное дерево поиска, без балансировки, в задании дерево с балансировкой

Comment thread task_08/src/HashTable.hpp Outdated

void insert(const Key& key, const Value& value);

bool search(const Key& key);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

нет функции которая возвращает value

Comment thread task_02/src/stack.hpp Outdated
if (size_ == 0) {
throw std::underflow_error("Empty stack");
}
T returning_value = top_->data;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

давай так чуть соптимизируем:
T returning_value = std::move(top_->data);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

weather_report.cpp
ну и hpp тоже переименуй

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

и в других задачах тоже

Comment thread task_04/src/heap.hpp Outdated
int GetLefrChildIndex(int i) { return 2 * i + 1; }
int GetRightChildIndex(int i) { return 2 * i + 2; }

void heapify(int i);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Heapify

Comment thread task_05/src/QuickSort.hpp Outdated
#include <vector>

template <class T>
int partition(std::vector<T>& v, int low, int high) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Partition

Comment thread task_06/src/nStatistics.hpp Outdated
#include <vector>

template <class T>
int partition(std::vector<T>& v, int low, int high) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

та же функция что и в предидущей задаче, давай вынесем в lib/src/utils.hpp

Comment thread task_07/src/BinaryTree.hpp Outdated
BinaryTree() : root_(nullptr) {}
~BinaryTree() { DestroyTree(root_); }

void insert(int value) { root_ = InsertRecursive(root_, value); }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Insert
и в других местах поправь имена методов по код стайлу

Comment thread task_08/src/HashTable.hpp Outdated
return pair.second;
}
}
throw std::logic_error("No such key in table");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

out_of_range

Comment thread task_08/src/HashTable.hpp Outdated
template <class Key, class Value>
void HashTable<Key, Value>::Rehash() {
std::vector<std::list<std::pair<Key, Value>>> new_table(table_.size() * 2);
for (const auto& list : table_) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

если убрать const в обеих for то можно будет переместить элементы: new_table[index].emplace_back(std::move(pair));

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