From 855fbf6789846200276bd0a5b5c23a4bc0ce793f Mon Sep 17 00:00:00 2001 From: HIMANSHU SHARMA Date: Sun, 27 Oct 2019 12:08:15 +0530 Subject: [PATCH] Minimum Swaps to Sort.c Given an array of N distinct elementsA[ ]. The task is to find the minimum number of swaps required to sort the array. Your are required to complete the function which returns an integer denoting the minimum number of swaps, required to sort the array. --- C/Minimum Swaps to Sort.c | 40 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 C/Minimum Swaps to Sort.c diff --git a/C/Minimum Swaps to Sort.c b/C/Minimum Swaps to Sort.c new file mode 100644 index 0000000..6549b1b --- /dev/null +++ b/C/Minimum Swaps to Sort.c @@ -0,0 +1,40 @@ +#include +using namespace std; +int min Swaps (int New, int N); +//Driver program to test the above function +int main() +{ +int t; +cin>>t; +while(t--) +{ +int n +cin>>n; +int a[n]; +for(int i=0;i>a[i]; +cout<