Conversation
| class Heap { | ||
| public: | ||
| Heap() : heap_array_(std::vector<T>{}){}; | ||
| explicit Heap(std::vector<T>& array) { |
There was a problem hiding this comment.
std::vector&& так будет понятнее что ты муваешь из вектора, и скорее всего им уже нельзя будет пользоваться после этого
There was a problem hiding this comment.
тестик для пустого дерева)
|
|
||
| template <typename T> | ||
| T Stack<T>::Pop() { | ||
| if (size_ == 0) throw std::runtime_error("Stack is empty"); |
There was a problem hiding this comment.
давай кидать out_of_range, более подходит по смыслу
и в стандартных контейнерах это исключение кидается
| // 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) { |
There was a problem hiding this comment.
можно ещё вернуть удалили ли элемент, но не обязательно
| ASSERT_EQ(stack.Size(), 0); | ||
| } | ||
|
|
||
| TEST(MinStackTest, PopFromEmptyStack) { |
| #include <stdexcept> | ||
| #include <vector> | ||
|
|
||
| // Function to find the k-th smallest element in a sorted sequence using |
There was a problem hiding this comment.
кажется тут не a sorted sequence, первоначально у нас массив не сортированый
There was a problem hiding this comment.
нет, тут все правильно, мы же ищем элемент по индексу в отсортированном массиве
| } | ||
|
|
||
| template <typename T> | ||
| void AVLTree<T>::Insert(T value) { |
There was a problem hiding this comment.
давай вернем удалось ли удалить из дерева
There was a problem hiding this comment.
давай ещё добавим тест с монетами {1,2,5,7,10} и нужно разменять 14
No description provided.