However, the number of  integers must be a power of 2. In main.c, key[ ] has 16 integers. But as you should already know, the program will not sort if one integers is removed or added.  What you are going to do is modify the mergesort.c module so that a non-power of 2  number of integers can be sorted. When you modify a module, indicate by way of  comment, what was changed, the date the change was made. You will also need to add or  remove an integer to/from key[] in module sort158a.c. You are NOT allowed to change merge.c, mergesort.h or wrt.c files The mergesort function in file mergesort.c MUST call the merge function which it currently does. The main function in sort158a.c you can only change the number of integers in the key[] array Below are 3 examples of output. The first with an array of 15 integers. The second with an array  of 16 (power of 2) integers and the third with 17 integers. Example of Output with 15 integers Before mergesort:  4 3 1 67 55 4 -5 37 7 4 2 9 1 -1 6 After mergesort:  -5 -1 1 1 2 3 4 4 4 6 7 9 37 55 67 Example of Output with 16 integers Before mergesort:  4 3 1 67 55 8 0 4 -5 37 7 4 2 9 1 -1  After mergesort:  -5 -1 0 1 1 2 3 4 4 4 7 8 9 37 55 67 Example of Output with 17 integers Before mergesort:  4 3 1 67 55 8 0 4 -5 37 7 4 2 9 1 -1 6 After mergesort:  -5 -1 0 1 1 2 3 4 4 4 6 7 8 9 37 55 67

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

However, the number of 
integers must be a power of 2. In main.c, key[ ] has 16 integers. But as you should already
know, the program will not sort if one integers is removed or added. 
What you are going to do is modify the mergesort.c module so that a non-power of 2 
number of integers can be sorted. When you modify a module, indicate by way of 
comment, what was changed, the date the change was made. You will also need to add or 
remove an integer to/from key[] in module sort158a.c.
You are NOT allowed to change merge.c, mergesort.h or wrt.c files
The mergesort function in file mergesort.c MUST call the merge function which it currently does.
The main function in sort158a.c you can only change the number of integers in the key[] array

Below are 3 examples of output. The first with an array of 15 integers. The second with an array 
of 16 (power of 2) integers and the third with 17 integers.
Example of Output with 15 integers
Before mergesort:
 4 3 1 67 55 4 -5 37 7 4 2 9 1 -1 6
After mergesort:
 -5 -1 1 1 2 3 4 4 4 6 7 9 37 55 67
Example of Output with 16 integers
Before mergesort:
 4 3 1 67 55 8 0 4 -5 37 7 4 2 9 1 -1 
After mergesort:
 -5 -1 0 1 1 2 3 4 4 4 7 8 9 37 55 67
Example of Output with 17 integers
Before mergesort:
 4 3 1 67 55 8 0 4 -5 37 7 4 2 9 1 -1 6
After mergesort:
 -5 -1 0 1 1 2 3 4 4 4 6 7 8 9 37 55 67

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps with 6 images

Blurred answer
Knowledge Booster
Stack operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education