Guest User

Untitled

a guest
Dec 7th, 2016
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. "void selection_sort<float>(float*, unsigned long)", referenced from:
  2.  
  3. #ifndef selectionsort_hpp
  4. #define selectionsort_hpp
  5.  
  6. #include <stddef.h>
  7. #include "swap.hpp"
  8.  
  9. template<typename T>
  10. void selection_sort(T[], size_t);
  11.  
  12. #endif /* selectionsort_hpp */
  13.  
  14. #include "selectionsort.hpp"
  15.  
  16. template<typename T>
  17. void selection_sort(T array[], size_t size) {
  18. for (size_t i = 0; i < size - 1; i++) {
  19. size_t minimal = i;
  20. for (size_t j = i + 1; j < size; j++) {
  21. if (array[minimal] > array[j]) {
  22. minimal = j;
  23. }
  24. }
  25. swap(array[minimal], array[i]);
  26. }
  27. }
Add Comment
Please, Sign In to add comment