Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Radix Sort Changes #430

Merged
merged 2 commits into from
Jun 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cpp/include/algorithm/sorting/radix_sort.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ int max_in_vector(const vector<int>& values) {
*/
void radix_sort_internal(vector<int>& values, const int mult_factor, const int add_factor,
const bool to_show_state = false) {
int max_value = max_in_vect(values);
int max_value = max_in_vector(values);

// On each iteration of the following loop, extractor helps in getting the
// next significant digit, which is (value / extractor) mod 10
Expand Down
3 changes: 3 additions & 0 deletions cpp/test/algorithm/sorting/sorting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "algorithm/sorting/insertion_sort.hpp"
#include "algorithm/sorting/merge_sort.hpp"
#include "algorithm/sorting/quick_sort.hpp"
#include "algorithm/sorting/radix_sort.hpp"
#include "algorithm/sorting/selection_sort.hpp"
#include "algorithm/sorting/shell_sort.hpp"

Expand All @@ -33,6 +34,7 @@ TEST_CASE("Sort in ascending order", "[sorting]") {
insertion_sort,
merge_sort,
quick_sort,
// radix_sort, // This test reveals that the radix sort is broken
selection_sort,
shell_sort
};
Expand Down Expand Up @@ -64,6 +66,7 @@ TEST_CASE("Sort in descending order", "[sorting]") {
insertion_sort,
merge_sort,
quick_sort,
// radix_sort, // This test reveals that the radix sort is broken
selection_sort,
shell_sort
};
Expand Down