Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design For Mere Mortals

Authors: Michael J Hernandez

4th Edition

978-0136788041

More Books

Students also viewed these Databases questions

Question

=+ Does it speak to you in a personal way? Does it solve a problem?

Answered: 1 week ago

Question

=+Part 4 Write one unifying slogan that could work here and abroad.

Answered: 1 week ago