Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please make sure its correct because the other chegg respondes were inccorect A . Mergesort ( 1 0 0 % ) Convert merge in Project

please make sure its correct because the other chegg respondes were inccorect A. Mergesort (100%)
Convert "merge" in Project 2 into a subroutine. Write a "main" program to perform
mergesorting of a list of integers by calling "merge" repeatedly. For example, if the
sorting program takes (6,5,9,1,7,0,-3,2) as input, it will produce a sorted list ,
2,5,6,7,9.
The original unsorted list of integers should be received from the keyboard input. Your
program should first ask for user to input the number of integers in the original list, and
then ask for inputting all the integers. The total number of integers to be sorted by this
program should be a power of 2. This means, the program should work with a list of 2,
4,8,16, or 32(...) integers (but your program needs only to handle up to 32 integers).
The final sorted list (in increasing order) should be stored in the data area, that starts
with the label "list:". The sorted list should also be displayed on the screen (console).
You should not do this part by implementing a different sorting algorithm (e.g., quick
sort). You will receive 0% if you do not make use of "merge", or if your sorted list is in
decreasing order.
[HINTS]: The bottom-up approach of implementation without using recursion is to
initially sort the smallest possible sub-lists, and then merge every two neighboring sub-
lists, until the whole list is merged and sorted. This non-recursive approach is more
efficient in general, and is thus required for this assignment. [An alternative is to sort
the list by dividing it into two sub-lists, recursively sorting the sub-lists, and then joining
the sub-lists together to give the sorted list. But this recursive approach is not required
in this assignment.]
image text in transcribed

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

Genomes And Databases On The Internet A Practical Guide To Functions And Applications

Authors: Paul Rangel

1st Edition

189848631X, 978-1898486312

More Books

Students also viewed these Databases questions

Question

1. Define the nature of interviews

Answered: 1 week ago

Question

2. Outline the different types of interviews

Answered: 1 week ago