Question: Java is being used. Objectives of this assignment: to explore time complexity and real time What you need to do: 1. Implement the Merge-Sort algorithm
Java is being used.


Objectives of this assignment: to explore time complexity and "real time" What you need to do: 1. Implement the Merge-Sort algorithm to sort an array. (See Appendix for the Merge-Sort algorithm) 2. Collect the execution time T(n) as a function of n 3. Plot the functions T(n)/log(n), T(n).log(n), and T(n)2.log(n) on the same graph. 4. In Module 4 (next module), we will establish that the running time T(n) of Merge-Sort is (n.log(n)). Discuss T(n) in light of the graph you plotted above. Objective: The objective of this programming assignment is to design and implement in Java the Merge-Sort algorithm presented in the lecture to sort a list of numbers. We are interested in exploring the relationship between the time the functions T(n)/log2(n), T(n).log(n), and T(n)2.log(n) on the same graph. Finally, discuss your results. Program to implement collectData() Generate an array of HUGE length L (as huge as your language allows) with random values capped at Oxfffffffe. for n = 5,000 to L (with step 1,000) copy in Array An first values from Array G Start timing // We time the sorting of Array A of length n Merge-Sort (A, 0, n-1) Store the value n and the values T(n)/log2 (n), T(n).log2 (n), and T(n).log(n) in a file F where T(n) is the execution time Data Analysis Use any plotting software (e.g., Excel) to plot the values T(n)/log(n), T(n).log(n), and T(n)2.log(n)in File F as a function of n. File F is the file produced by the program you implemented. Discuss your results based on the plots. (Hint: is T(n) closer to K. log(n), K. n.log2(n), or K. n2.log(n) where K is a constant?) Report Write a report that will contain, explain, and discuss the plot. The report should not exceed one page. In addition, your report must contain the following information: o whether the program works or not (this must be just ONE sentence) o the directions to compile and execute your program Good writing is expected. Recall that answers must be well written, documented, justified, and presented to get full credit. What you need to turn in: Electronic copy of your source program Electronic copy of the report (including your answers) (standalone). Submit the file as a Microsoft Word or PDF file. Grading Program is worth 30% if it works and provides data to analyze Quality of the report is worth 70% distributed as follows: good plot (25%), explanations of plot (10%), discussion and conclusion (35%). Appendix: Merge-Sort Algorithm. At this stage, you do NOT need to understand Merge-Sort (It will be presented and explained in Module 4)). Implement Merge-Sort exactly the way it is described below. Replace the infinity value (c) with Oxffffffff. MERGE-SORT(A, p,r). 1 if p
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
