-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Task 1 #20
base: main
Are you sure you want to change the base?
Task 1 #20
Conversation
Амортизационный анализ
Depreciation analysis
…нализ алгоритмов.pdf
task_02/src/stack.hpp
Outdated
: data(_data), prevptr(_prev) {} | ||
StackNode() : data(), prevptr(nullptr) {} | ||
T data; | ||
StackNode<T> *prevptr; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prev_ptr
task_02/src/stack.hpp
Outdated
int Pop(); | ||
Stack() : top(nullptr), size(0) {} | ||
void push(T value); | ||
T pop(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pop
task_02/src/stack.hpp
Outdated
void push(T value); | ||
T pop(); | ||
T getTop(); | ||
int getSize(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GetSize
task_02/src/stack.hpp
Outdated
Stack() : top(nullptr), size(0) {} | ||
void push(T value); | ||
T pop(); | ||
T getTop(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GetTop
task_02/src/stack.hpp
Outdated
|
||
private: | ||
std::stack<int> data_; | ||
StackNode<T> *top; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
top_
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 << " "; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
это лишнее для теста
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ой, да, это рудимент какой-то
task_07/src/BinaryTree.hpp
Outdated
template <class T> | ||
class BinaryTree { | ||
public: | ||
BinaryTree() : root(nullptr) {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
тут виже только обычное дерево поиска, без балансировки, в задании дерево с балансировкой
task_08/src/HashTable.hpp
Outdated
|
||
void insert(const Key& key, const Value& value); | ||
|
||
bool search(const Key& key); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
нет функции которая возвращает value
task_02/src/stack.hpp
Outdated
if (size_ == 0) { | ||
throw std::underflow_error("Empty stack"); | ||
} | ||
T returning_value = top_->data; |
There was a problem hiding this comment.
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);
task_03/src/WeatherReport.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
weather_report.cpp
ну и hpp тоже переименуй
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
и в других задачах тоже
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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heapify
task_05/src/QuickSort.hpp
Outdated
#include <vector> | ||
|
||
template <class T> | ||
int partition(std::vector<T>& v, int low, int high) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Partition
task_06/src/nStatistics.hpp
Outdated
#include <vector> | ||
|
||
template <class T> | ||
int partition(std::vector<T>& v, int low, int high) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
та же функция что и в предидущей задаче, давай вынесем в lib/src/utils.hpp
task_07/src/BinaryTree.hpp
Outdated
BinaryTree() : root_(nullptr) {} | ||
~BinaryTree() { DestroyTree(root_); } | ||
|
||
void insert(int value) { root_ = InsertRecursive(root_, value); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Insert
и в других местах поправь имена методов по код стайлу
task_08/src/HashTable.hpp
Outdated
return pair.second; | ||
} | ||
} | ||
throw std::logic_error("No such key in table"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
out_of_range
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_) { |
There was a problem hiding this comment.
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));
No description provided.