Question: c++ Your program will sort a two dimensional array (5 * 4) based on the following: The entire array should be sorted using bubble sort

c++ Your program will sort a two dimensional array (5 * 4) based on the following:

  1. The entire array should be sorted using bubble sort based on the 1st column in ascending order and display the entire array.
  2. Reset the array to its original contents. The entire array should again be sorted using selection sort based on the 2nd column in descending order and display the entire array.
  3. Reset the array to its original contents. The entire array should again be sorted using shell sort based on the 3rd column in ascending order and display the entire array
  4. Reset the array to its original contents. The entire array should again be sorted using insertion sort based on the 5th row in ascending order and display the entire array

Ask the user for a number, search for that number in the 5th row of the array that was sorted via insertion sort, using binary search. Display the entire column.

Your array could be declared as a global variable since it is being used everywhere.

For example, given the following array:

5

3

2

16

9

8

10

17

4

7

11

18

2

5

9

12

7

9

4

10

5

3

2

16

9

8

10

17

4

7

11

18

2

5

9

12

5th row

Insertion

Ascending

7

9

4

10

1st column

Bubble

Ascending

2nd column

Selection

Descending

3rd column

Shell

Ascending

After bubble sort

2

5

9

12

4

7

11

18

5

3

2

16

7

9

4

10

9

8

10

17

After selection sort (Descending order)

7

9

4

10

9

8

10

17

4

7

11

18

2

5

9

12

5

3

2

16

Do the same kind of thing for shell sort (Ascending order based on the 3rd column)

After Insertion sort

2

5

3

16

10

9

8

17

11

4

7

18

9

2

5

12

4

7

9

10

What number are you searching for in the 5th row? 9

3

8

7

5

9

Make sure to modularize your program. Each of the sorts and searches must happen in their own functions. Reset the array to its original contents after each sort.

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!