|
Algorithms_in_C++ 1.0.0
Set of algorithms implemented in C++.
|
Implementation of the DNF sort implementation. More...
#include <algorithm>#include <cassert>#include <iostream>#include <vector>Namespaces | |
| namespace | sorting |
| for working with vectors | |
| namespace | dnf_sort |
| Functions for the DNF sort implementation. | |
Functions | |
| template<typename T > | |
| std::vector< T > | sorting::dnf_sort::dnfSort (const std::vector< T > &in_arr) |
| The main function implements DNF sort. More... | |
| static void | test () |
| Self-test implementations. More... | |
| int | main () |
| Main function. More... | |
Implementation of the DNF sort implementation.
C++ program to sort an array with 0, 1 and 2 in a single pass(DNF sort). Since one traversal of the array is there hence it works in O(n) time complexity.
| std::vector< T > sorting::dnf_sort::dnfSort | ( | const std::vector< T > & | in_arr | ) |
The main function implements DNF sort.
| T | type of array |
| a | array to be sorted, |
| arr_size | size of array |
| int main | ( | void | ) |
|
static |
Self-test implementations.