Question: Create a Project named ExternalMergeSort in Java. Your task is to implement external merge sorting algorithm to sort files. The controlling parameters, N (the number

Create a Project named ExternalMergeSort in Java. Your task is to implement external merge sorting algorithm to sort files. The controlling parameters, N (the number of pages in the file) and M (the number of buffers in memory), should be obtained as command line arguments. Assume that each page in the data file contains 2 integers and each buffer in main memory can hold 2 integers. Use a random number generator to generate random integers within the data file. Then, split the data file into chunks, sort each chunk, and merge the chunks into a single, sorted file using the external merge sorting algorithm. After the initial splitting of data, use the quicksort algorithm to sort the chunks or runs and then perform merge passes with M pages in memory using the external merge algorithm. Your program should print information regarding the number of runs, the number of merge passes, and the I/O (input/output) cost for sorting a file. To do this, complete an I/O cost table for various combinations of the number of pages in the file and the number of buffers in memory. Finally, you need to analyze the changes in the I/O cost for different number of pages and buffers and submit a report detailing your observations. Your analysis should at least include the following: What are the possible options to reduce I/O cost and the major challenges associated with these options? Which one is the best solution in your opinion? Explain the reasons for selecting the best solution. Your program should display a report similar to the following output, but the user should have the ability to change the number of pages and buffers.

N (number of pages in a file) M (number of buffers in memory) Number of runs (sorted chunks) Total Number of Merge Passes Total I/O cost

produced in the first pass for sorting the file

1000 3 -- -- --

1000 6 -- -- --

1000 12 -- -- --

2000 3 -- -- --

2000 6 -- -- --

2000 12 -- -- --

4000 3 -- -- --

4000 6 -- -- --

4000 12 -- -- --

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!