AceSorting
1.0.0
Sorting algorithms for Arduino including Bubble Sort, Insertion Sort, Selection Sort, Shell Sort (3 versions), Comb Sort (4 versions), Quick Sort (3 versions)
|
#include "swap.h"
Go to the source code of this file.
Macros | |
#define | ACE_SORTING_DIRECT_SELECTION_SORT 0 |
If set to 1, use the direct inlined implementation of the 2-argument selectionSort(). More... | |
Functions | |
template<typename T > | |
void | ace_sorting::selectionSort (T data[], uint16_t n) |
Selection sort. More... | |
template<typename T , typename F > | |
void | ace_sorting::selectionSort (T data[], uint16_t n, F &&lessThan) |
Same as the 2-argument selectionSort() with the addition of a lessThan lambda expression or function. More... | |
Selection sort. See https://en.wikipedia.org/wiki/Selection_sort
Definition in file selectionSort.h.
#define ACE_SORTING_DIRECT_SELECTION_SORT 0 |
If set to 1, use the direct inlined implementation of the 2-argument selectionSort().
Otherwise, use the 3-argument selectionSort() to implement 2-argument selectionSort(). For selectionSort(), the compiler will optimize both versions to be identical.
Definition at line 46 of file selectionSort.h.
void ace_sorting::selectionSort | ( | T | data[], |
uint16_t | n | ||
) |
Selection sort.
Average complexity: O(n^2) See https://en.wikipedia.org/wiki/Selection_sort
T | type of data to sort |
Definition at line 89 of file selectionSort.h.
void ace_sorting::selectionSort | ( | T | data[], |
uint16_t | n, | ||
F && | lessThan | ||
) |
Same as the 2-argument selectionSort() with the addition of a lessThan
lambda expression or function.
T | type of data to sort |
F | type of lambda expression or function that returns true if a < b |
Definition at line 105 of file selectionSort.h.