Skip to content

Task 2#24

Open
dfsavffc wants to merge 23 commits intoAlgorithmsDafeMipt2024:mainfrom
dfsavffc:task_2
Open

Task 2#24
dfsavffc wants to merge 23 commits intoAlgorithmsDafeMipt2024:mainfrom
dfsavffc:task_2

Conversation

@dfsavffc
Copy link
Copy Markdown
Contributor

No description provided.

Comment thread task_02/src/test.cpp
Comment thread task_04/src/heap.hpp Outdated
class Heap {
public:
Heap() : heap_array_(std::vector<T>{}){};
explicit Heap(std::vector<T>& array) {
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.

std::vector&& так будет понятнее что ты муваешь из вектора, и скорее всего им уже нельзя будет пользоваться после этого

Comment thread task_07/src/bs_tree.hpp
Comment thread task_07/src/test.cpp
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_02/src/stack.hpp Outdated

template <typename T>
T Stack<T>::Pop() {
if (size_ == 0) throw std::runtime_error("Stack is empty");
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_07/src/bs_tree.hpp Outdated
// Private method to remove a value recursively from the binary search tree
// starting from the given node
template <typename T>
void BSTree<T>::Remove(T value, std::unique_ptr<BSTNode> &node) {
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_02/src/test.cpp Outdated
ASSERT_EQ(stack.Size(), 0);
}

TEST(MinStackTest, PopFromEmptyStack) {
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.

дубль, строка 31

Comment thread task_02/src/test.cpp
#include <stdexcept>
#include <vector>

// Function to find the k-th smallest element in a sorted sequence using
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.

кажется тут не a sorted sequence, первоначально у нас массив не сортированый

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

нет, тут все правильно, мы же ищем элемент по индексу в отсортированном массиве

Comment thread task_07/src/avl_tree.hpp
}

template <typename T>
void AVLTree<T>::Insert(T 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.

давай вернем удалось ли удалить из дерева

Comment thread task_09/src/test.cpp
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.

давай ещё добавим тест с монетами {1,2,5,7,10} и нужно разменять 14

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