From 4cb8491dd56c0dc5d1645dc9dd3c59038d293d87 Mon Sep 17 00:00:00 2001 From: abdurrezzak Date: Tue, 24 Oct 2017 00:55:44 +0300 Subject: [PATCH] Add files via upload --- 5.SelectionSort.cpp | 46 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 5.SelectionSort.cpp 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