Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- "void selection_sort<float>(float*, unsigned long)", referenced from:
- #ifndef selectionsort_hpp
- #define selectionsort_hpp
- #include <stddef.h>
- #include "swap.hpp"
- template<typename T>
- void selection_sort(T[], size_t);
- #endif /* selectionsort_hpp */
- #include "selectionsort.hpp"
- template<typename T>
- void selection_sort(T array[], size_t size) {
- for (size_t i = 0; i < size - 1; i++) {
- size_t minimal = i;
- for (size_t j = i + 1; j < size; j++) {
- if (array[minimal] > array[j]) {
- minimal = j;
- }
- }
- swap(array[minimal], array[i]);
- }
- }
Add Comment
Please, Sign In to add comment