Question: please help me to resolve these errors of insertion sort 2d array in c++(ascending order) #include #include #include using namespace std; int main() { int

please help me to resolve these errors of insertion sort 2d array in c++(ascending order)

#include

#include

#include

using namespace std;

int main()

{

int array[3][5] = { { 12,45,78,21,54 },{ 98,65,32,89,56 },{ 74,14,85,25,96 } };

int r = 3;

int c = 5;

void sort(int r, int c);

for (int i = 0; i

{

for (int j = 0; j

if (i % 2 == 0)

{

int min = array[i][j], pos = i;

for (int k = i + 1; k

{

if (array[k][j]

array[k][j] = min;

pos = k;

}

array[pos][j] = array[i][j];

array[i][j] = min;

}

else

{

int max = array[i][j], pos1 = i;

for (int l = i + 1; l

{

if (array[l][j]>max)

array[l][j] = max;

pos1 = l;

}

array[pos1][j] = array[i][j];

array[i][j] = max;

}

}

}

void display(int r, int c)

{

cout << endl << "Array is" << endl;

for (int i = 0; i

for (int j = 0; j

{

cout <

}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!