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

feat: add dnf sort #1558

Merged
merged 21 commits into from
Aug 19, 2021
Merged

feat: add dnf sort #1558

merged 21 commits into from
Aug 19, 2021

Conversation

heysujal
Copy link
Contributor

@heysujal heysujal commented Aug 13, 2021

Closes #1549
Added dnf sort.

@foo290
Copy link
Contributor

foo290 commented Aug 13, 2021

Nice 😃, Have a look at the formatting that matches repository standards here and consider refactoring. 😃

@heysujal heysujal marked this pull request as draft August 13, 2021 07:52
@heysujal heysujal marked this pull request as ready for review August 13, 2021 07:56
@heysujal
Copy link
Contributor Author

@foo290 I have made some changes please have a look.

@Panquesito7 Panquesito7 added the enhancement New feature or request label Aug 13, 2021
@Panquesito7 Panquesito7 changed the title add dnf sort feat: add dnf sort Aug 13, 2021
@Panquesito7 Panquesito7 added the automated tests are failing Do not merge until tests pass label Aug 13, 2021
Copy link
Member

@Panquesito7 Panquesito7 left a comment

Choose a reason for hiding this comment

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

Hello, @heysujal; thanks for your contribution! Sadly, your code is not up to the repository standards.
Please read them carefully, and take your time. 🙂

@Panquesito7 Panquesito7 added Proper Documentation Required requested to write the documentation properly requested changes changes required labels Aug 13, 2021
@heysujal
Copy link
Contributor Author

heysujal commented Aug 14, 2021

@Panquesito7 Got it, I will be making changes again.Meanwhile, I found Counting Sort not following the standards.
Initially, I saw this I thought there would be no problem. But now I am taking reference from Cycle Sort .

Is it okay , if I use the code of GeeksForGeeks as long as I am giving their reference ?

@Panquesito7
Copy link
Member

For me, that sounds good, as long as you mention where you took it from. @ayaankhan98, @mishraabhinn, thoughts?

@heysujal
Copy link
Contributor Author

@Panquesito7 I have done some changes and tried to keep code up to the standards. Please give your review.

@Swastyy
Copy link
Contributor

Swastyy commented Aug 16, 2021

Hi @heysujal Consider using uint64_t for non-negative values (or their appropriate size: uint32_t, uint16_t, uint8_t) or int64_t for negative values in the dnfSort function too.

@heysujal
Copy link
Contributor Author

@Swastyy Done the changes , have a look.

Copy link
Member

@Panquesito7 Panquesito7 left a comment

Choose a reason for hiding this comment

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

Amazing work! 😄👍
Please enable GitHub Actions in your repository of this fork in this link: https://github.com/heysujal/C-Plus-Plus/actions

sorting/dnf_sort.cpp Outdated Show resolved Hide resolved
sorting/dnf_sort.cpp Outdated Show resolved Hide resolved
sorting/dnf_sort.cpp Outdated Show resolved Hide resolved
sorting/dnf_sort.cpp Outdated Show resolved Hide resolved
sorting/dnf_sort.cpp Show resolved Hide resolved
sorting/dnf_sort.cpp Outdated Show resolved Hide resolved
sorting/dnf_sort.cpp Outdated Show resolved Hide resolved
sorting/dnf_sort.cpp Outdated Show resolved Hide resolved
sorting/dnf_sort.cpp Outdated Show resolved Hide resolved
template <typename T>
std::vector<T> dnfSort(const std::vector<T> &in_arr) {
std::vector<T> arr(in_arr);
int lo = 0;
Copy link
Member

Choose a reason for hiding this comment

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

Consider using uint64_t for non-negative values (or their appropriate size: uint32_t, uint16_t, uint8_t) or int64_t for negative values. Check other parts of the code (reference). 🙂

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think you are referring to these 3 variables being used lo , hi and mid to make them uint64_t instead of int.

Copy link
Member

Choose a reason for hiding this comment

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

Correct.

@Panquesito7 Panquesito7 removed automated tests are failing Do not merge until tests pass Proper Documentation Required requested to write the documentation properly labels Aug 16, 2021
heysujal and others added 4 commits August 17, 2021 13:09
Co-authored-by: David Leal <halfpacho@gmail.com>
Co-authored-by: David Leal <halfpacho@gmail.com>
Co-authored-by: David Leal <halfpacho@gmail.com>
Co-authored-by: David Leal <halfpacho@gmail.com>
heysujal and others added 7 commits August 17, 2021 13:10
Co-authored-by: David Leal <halfpacho@gmail.com>
Co-authored-by: David Leal <halfpacho@gmail.com>
Co-authored-by: David Leal <halfpacho@gmail.com>
Co-authored-by: David Leal <halfpacho@gmail.com>
Co-authored-by: David Leal <halfpacho@gmail.com>
heysujal and others added 2 commits August 18, 2021 15:16
Co-authored-by: David Leal <halfpacho@gmail.com>
Copy link
Member

@Panquesito7 Panquesito7 left a comment

Choose a reason for hiding this comment

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

LGTM. Awesome work, @heysujal! You've done great work for this PR to be your first contribution in The Algorithms. We hope you keep contributing. Keep up the good work! 😄👍🎉

@heysujal
Copy link
Contributor Author

LGTM. Awesome work, @heysujal! You've done great work for this PR to be your first contribution in The Algorithms. We hope you keep contributing. Keep up the good work! 😄👍🎉

Thank you for helping me out and giving feedback.

@ayaankhan98 ayaankhan98 merged commit c3b07ae into TheAlgorithms:master Aug 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request requested changes changes required
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] Addition of dnf_sort in sorting folder
5 participants