diff --git a/sorting/cycle_sort.cpp b/sorting/cycle_sort.cpp index fdd157292..23bb1e18c 100644 --- a/sorting/cycle_sort.cpp +++ b/sorting/cycle_sort.cpp @@ -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 array3 = {3, 3, 3, 3}; std::cout << "Test 3... ";