From 585039aa4c28faab64923eee0ba860bedeb48a03 Mon Sep 17 00:00:00 2001 From: Kanak Chaudhary <97454125+kanak-chaudhary@users.noreply.github.com> Date: Sun, 23 Oct 2022 10:32:57 +0530 Subject: [PATCH] Selection Sort.cpp --- Selection sort.cpp | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 Selection sort.cpp diff --git a/Selection sort.cpp b/Selection sort.cpp new file mode 100644 index 0000000..22ddf0f --- /dev/null +++ b/Selection sort.cpp @@ -0,0 +1,38 @@ +#include +using namespace std; +void swapping(int &a, int &b) { + int temp; + temp = a; + a = b; + b = temp; +} +void display(int *array, int size) { + for(int i = 0; i> n; + int arr[n]; + cout << "Enter elements:" << endl; + for(int i = 0; i> arr[i]; + } + cout << "Array before Sorting: "; + display(arr, n); + selectionSort(arr, n); + cout << "Array after Sorting: "; + display(arr, n); +} \ No newline at end of file