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_BUBBLE_SORT 0 |
If set to 1, use the direct inlined implementation of the 2-argument bubbleSort(). More... | |
Functions | |
template<typename T > | |
void | ace_sorting::bubbleSort (T data[], uint16_t n) |
Bubble sort. More... | |
template<typename T , typename F > | |
void | ace_sorting::bubbleSort (T data[], uint16_t n, F &&lessThan) |
Same as the 2-argument bubbleSort() with the addition of a lessThan lambda expression or function. More... | |
Bubble sort.
Definition in file bubbleSort.h.
#define ACE_SORTING_DIRECT_BUBBLE_SORT 0 |
If set to 1, use the direct inlined implementation of the 2-argument bubbleSort().
Otherwise, use the 3-argument bubbleSort() to implement 2-argument bubbleSort(). For bubbleSort, the compiler will optimize both versions to be identical.
Definition at line 43 of file bubbleSort.h.
void ace_sorting::bubbleSort | ( | T | data[], |
uint16_t | n | ||
) |
Bubble sort.
Average complexity: O(n^2)
T | type of data to sort |
Definition at line 70 of file bubbleSort.h.
void ace_sorting::bubbleSort | ( | T | data[], |
uint16_t | n, | ||
F && | lessThan | ||
) |
Same as the 2-argument bubbleSort() 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 84 of file bubbleSort.h.