Minimum number of swaps required to sort an array
Given an array arr of size n, the task is to sort this array using minimum swaps. We are allowed to swap only adjacent elements. Examples: Input: arr[] = {1, 4, 3, 5, 2} Output: 4 Explaination: After 1st swap: arr[] = {1, 4, 3, 2, 5} After 2nd swap: arr[] = {1, 4, 2, 3, 5} After… Read More »