From faa6c73c27e8a7f5d9ad039f07cc960b0bea46b8 Mon Sep 17 00:00:00 2001
From: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Date: Tue, 13 Jul 2021 00:56:20 +0000
Subject: [PATCH] Documentation for 82290e72c540e63aabd7af9abe487bc0a4aa6d64
---
de/d07/cycle__sort_8cpp.html | 149 ++++++++++++++++++++---------------
1 file changed, 85 insertions(+), 64 deletions(-)
diff --git a/de/d07/cycle__sort_8cpp.html b/de/d07/cycle__sort_8cpp.html
index 9a514934f..9d20cdd8c 100644
--- a/de/d07/cycle__sort_8cpp.html
+++ b/de/d07/cycle__sort_8cpp.html
@@ -135,8 +135,7 @@ Functions
Implementation of Cycle sort algorithm.
-
Cycle Sort is a sorting algorithm that works in \(O(n^2)\) time in best cas and works in \(O(n^2)\) 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
+
Cycle Sort is a sorting algorithm that works in \(O(n^2)\) time in the best case and works in \(O(n^2)\) 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
-
-
41 for (
size_t cycle_start = 0; cycle_start <= arr.size() - 1; cycle_start++) {
-
-
43 T item = arr[cycle_start];
-
-
-
-
47 int pos = cycle_start;
-
48 for (
size_t i = cycle_start + 1; i < arr.size(); i++) {
-
-
-
-
-
-
-
55 if (pos == cycle_start) {
-
-
-
-
-
60 while (item == arr[pos]) pos += 1;
-
-
-
-
64 while (pos != cycle_start) {
-
-
-
67 for (
size_t i = cycle_start + 1; i < arr.size(); i++) {
-
-
-
-
-
-
73 while (item == arr[pos]) pos += 1;
-
-
-
-
-
+
+
+
39 for (
int cycle_start = 0; cycle_start <= arr.size() - 1; cycle_start++) {
+
+
41 T item = arr[cycle_start];
+
+
+
+
45 int pos = cycle_start;
+
46 for (
int i = cycle_start + 1; i < arr.size(); i++) {
+
+
+
+
+
+
+
53 if (pos == cycle_start) {
+
+
+
+
+
58 while (item == arr[pos]) pos += 1;
+
59 if (pos == cycle_start) {
+
+
+
+
+
+
65 while (pos != cycle_start) {
+
+
+
68 for (
size_t i = cycle_start + 1; i < arr.size(); i++) {
+
+
+
+
+
+
74 while (item == arr[pos]) pos += 1;
+
75 if (item == arr[pos]) {
+
+
+
+
+
+
+
+
Main function.
- Returns
- 0 on exit
-
-
-
-
-
static void test()
Test implementations.
Definition: cycle_sort.cpp:86
+
+
+
+
+
static void test()
Test implementations.
Definition: cycle_sort.cpp:91
@@ -278,25 +284,40 @@ Here is the call graph for this function:
Test implementations.
- Returns
- void
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
std::vector< T > cycleSort(const std::vector< T > &in_arr)
The main function implements cycleSort.
Definition: cycle_sort.cpp:39
+
std::vector< T > cycleSort(const std::vector< T > &in_arr)
The main function implements cycleSort.
Definition: cycle_sort.cpp:37