MCPcopy Create free account
hub / github.com/Rohit91singh9/Coding-DP-DSA / getMinMoves

Function getMinMoves

getMinMoves.cpp:4–18  ·  view source on GitHub ↗

function

Source from the content-addressed store, hash-verified

2using namespace std;
3//function
4int getMinMoves(int arr[], int n)
5{
6 int i, j, k = 0;
7 //starting nested loop here
8 for (i = 0; i < n - 1; i++)
9 for (j = 0; j < n - i - 1; j++)
10 if (arr[j] > arr[j + 1])
11 swap(arr[j], arr[j + 1]);
12 //printing Correct Order
13 cout<<"Correct Order: ";
14 for (k= 0; k < n; k++) //for loop
15 cout << arr[k] << " ";
16 cout << endl;
17 return 0;
18}
19int main()
20{
21 int plates[5] = {4, 6, 3, 2, 5};

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected