Skip to content
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

Homework 2 #27

Open
wants to merge 92 commits into
base: main
Choose a base branch
from
Open

Homework 2 #27

wants to merge 92 commits into from

Conversation

H0p1ty
Copy link

@H0p1ty H0p1ty commented Apr 6, 2024

Task_02, Task_03, ... Task_09

@H0p1ty H0p1ty changed the title Task 02, Task 03, Task 08 Homework 2 Apr 6, 2024
task_02/src/test.cpp Show resolved Hide resolved
template <constructable CustomType, comparing<CustomType> Function>
Heap<CustomType, Function>::Heap(
std::function<bool(const CustomType&, const CustomType&)>
comparing_function_)
Copy link
Contributor

Choose a reason for hiding this comment

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

по код стайлу обычно если в конце переменной _ то это переменная из private. но можно и так ещё сделать:

Heap<CustomType, Function>::Heap(std::function<...> comparing_function)`: data{}, heap_size{0}, comparing_function(comparing_function) {}

Copy link
Contributor

Choose a reason for hiding this comment

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

если выше исправишь, то и тут будет карсиво comparing_function_(comparing_function)

Copy link
Author

Choose a reason for hiding this comment

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

done

// where n - length of first array, m - length of second array
template <typename CustomType, comparing<CustomType> Function = std::function<
bool(const CustomType&, const CustomType&)>>
void merge_two_sorted_arrays(
Copy link
Contributor

Choose a reason for hiding this comment

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

MergeTwoSortedArrays

Copy link
Author

Choose a reason for hiding this comment

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

renamed

// time complexity - O(nlogn) where n - length of an array
template <typename CustomType, comparing<CustomType> Function = std::function<
bool(const CustomType&, const CustomType&)>>
void merge_sort(
Copy link
Contributor

Choose a reason for hiding this comment

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

MergeSort

Copy link
Author

Choose a reason for hiding this comment

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

renamed

task_05/src/test.cpp Show resolved Hide resolved
task_05/src/test.cpp Show resolved Hide resolved
Copy link
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

Copy link
Author

Choose a reason for hiding this comment

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

done

task_02/src/stack.hpp Outdated Show resolved Hide resolved
task_02/src/stack.hpp Show resolved Hide resolved
task_03/src/weather.h Outdated Show resolved Hide resolved
void SiftUp(size_t index);
size_t heap_size;

std::function<bool(const CustomType&, const CustomType&)> comparing_function;
Copy link
Contributor

Choose a reason for hiding this comment

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

кажется нужно эти поля в private отправить, ну и имя comparing_function_ как приватное поле

Copy link
Author

@H0p1ty H0p1ty Jun 7, 2024

Choose a reason for hiding this comment

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

Так они и так в private находится

Copy link
Contributor

Choose a reason for hiding this comment

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

я про то что на конце имени "_" поставить

template <constructable CustomType, comparing<CustomType> Function>
Heap<CustomType, Function>::Heap(
std::function<bool(const CustomType&, const CustomType&)>
comparing_function_)
Copy link
Contributor

Choose a reason for hiding this comment

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

если выше исправишь, то и тут будет карсиво comparing_function_(comparing_function)

task_05/src/sort.hpp Show resolved Hide resolved
task_05/src/test.cpp Show resolved Hide resolved
task_07/src/splay_tree.hpp Outdated Show resolved Hide resolved
task_07/src/splay_tree.hpp Outdated Show resolved Hide resolved
task_09/src/test.cpp Outdated Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

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

удали лишний файл из ПРа)

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