|  | TheAlgorithms/C++ 1.0.0
    All the algorithms implemented in C++ | 
Stooge sort implementation in C++ More...
#include <vector>#include <cassert>#include <algorithm>#include <iostream>Go to the source code of this file.
| Functions | |
| void | stoogeSort (std::vector< int > *L, size_t i, size_t j) | 
| for IO operations | |
| void | test1 () | 
| Function to test sorting algorithm. | |
| void | test2 () | 
| Function to test sorting algorithm, one element. | |
| void | test3 () | 
| Function to test sorting algorithm, repeating elements. | |
| int | main () | 
| Main function. | |
Stooge sort implementation in C++
Stooge sort is a recursive sorting algorithm. It divides the array into 3 parts and proceeds to:
Definition in file stooge_sort.cpp.
| int main | ( | void | ) | 
Main function.
Definition at line 77 of file stooge_sort.cpp.
| void stoogeSort | ( | std::vector< int > * | L, | 
| size_t | i, | ||
| size_t | j ) | 
for IO operations
for vector for assert for std::is_sorted
The stoogeSort() function is used for sorting the array.
| L | - vector of values (int) to be sorted in in place (ascending order) | 
| i | - the first index of the array (0) | 
| j | - the last index of the array (L.size() - 1) | 
Definition at line 28 of file stooge_sort.cpp.
| void test1 | ( | ) | 
Function to test sorting algorithm.
Definition at line 47 of file stooge_sort.cpp.
| void test2 | ( | ) | 
Function to test sorting algorithm, one element.
Definition at line 57 of file stooge_sort.cpp.
| void test3 | ( | ) | 
Function to test sorting algorithm, repeating elements.
Definition at line 67 of file stooge_sort.cpp.