diff --git a/5.SelectionSort.cpp b/5.SelectionSort.cpp new file mode 100644 index 0000000..1ef35b7 --- /dev/null +++ b/5.SelectionSort.cpp @@ -0,0 +1,46 @@ +/* + * This program takes an array from the user + * sorts it using selection sort + * Prints the sorted array + * For more information about Insertion Sort Algorithm: https://en.wikipedia.org/wiki/Selection_sort + * + * Coded by: Abdurrezak EFE + * + * */ +#include +#include +using namespace std; + +void selection_sort(int arr[],int k) //insertion sort function +{ + + for(int i=0;i> k; + + int arr[k]; + for(int i=0;i> arr[i]; + + selection_sort(arr,k); //sorting + + for(int i=0;i