mirror of
https://github.com/TheAlgorithms/C-Plus-Plus.git
synced 2026-02-11 22:46:39 +08:00
clang-format and clang-tidy fixes for 2601c621
This commit is contained in:
@@ -1,8 +1,13 @@
|
||||
/**
|
||||
* @file
|
||||
* @brief Implementation of [Cycle sort](https://en.wikipedia.org/wiki/Cycle_sort) algorithm
|
||||
* @brief Implementation of [Cycle
|
||||
* sort](https://en.wikipedia.org/wiki/Cycle_sort) algorithm
|
||||
* @details
|
||||
* Cycle Sort is a sorting algorithm that works in \f$O(n^2)\f$ time in best case and works in \f$O(n^2)\f$ in worst case. If a element is already at its correct position, do nothing. If a element is not at its correct position, we then need to move it to its correct position by computing the correct positions.Therefore, we should make sure the duplicate elements.
|
||||
* Cycle Sort is a sorting algorithm that works in \f$O(n^2)\f$ time in best
|
||||
* case and works in \f$O(n^2)\f$ in worst case. If a element is already at its
|
||||
* correct position, do nothing. If a element is not at its correct position,
|
||||
* we then need to move it to its correct position by computing the correct
|
||||
* positions.Therefore, we should make sure the duplicate elements.
|
||||
* @author [TsungHan Ho](https://github.com/dalaoqi)
|
||||
*/
|
||||
|
||||
@@ -18,7 +23,8 @@
|
||||
namespace sorting {
|
||||
/**
|
||||
* @namespace cycle_sort
|
||||
* @brief Functions for [Cycle sort](https://en.wikipedia.org/wiki/Cycle_sort) algorithm
|
||||
* @brief Functions for [Cycle sort](https://en.wikipedia.org/wiki/Cycle_sort)
|
||||
* algorithm
|
||||
*/
|
||||
namespace cycle_sort {
|
||||
/**
|
||||
@@ -98,7 +104,7 @@ static void test() {
|
||||
assert(std::is_sorted(std::begin(arr2), std::end(arr2)));
|
||||
std::cout << "passed" << std::endl;
|
||||
|
||||
// Test 3
|
||||
// Test 3
|
||||
// [3, 3, 3, 3] return [3, 3, 3, 3]
|
||||
std::vector<int> array3 = {3, 3, 3, 3};
|
||||
std::cout << "Test 3... ";
|
||||
|
||||
Reference in New Issue
Block a user