Question: Add merge sort and quick sort methods to xxxxxH1.java e program and Modify each sort method to compute no. of comparison and swaps. can you






Save the following java program into xxxxxH1.java and do as follow: a) Do not modify constructor and main method (except writing your name in line 92). b) Add merge sort and quick sort methods to xxxxXH1.java e program. c) Modify each sort method to compute no. of comparison and swaps. d) A sample input is as follow: 45 10 84 82 52 80 96 85 75 75 82 87 92 89 57 94 93 92 63 99 87 72 73 56 74 50 84 62 72 55 86 75 74 100 83 60 53 68 89 67 66 65 72 94 73 54 98 1 import java.io.*; 2 import java.util.*; 3 4// CSUN COMP 282 Sp 21, Homework-1 5// Implementing mergesort and quicksort algorithms 6 // and printing no. of comparisons and swaps. 7 // Author: G. Dastghaiby Fard 8 public class xxxxxH1{ 9 // class variables 10 int arr[], barri), n, k; 11 //varibles to count no. of comparisons and swaps 12 int ncomps, nswaps; 13 14 // class constructor 15 xxxxxH10){ 16 int i; 17 prt.print("\tThis Java program implements mergesort and quicksort algorithms \tand prints no. of comparisons and swaps." + "The program first reads \tn,k and next reads n integers and stores" + "them in array barr[]- \tApplies mergesort and quicksort to the same" + "data and \tprint no. of comparisons and swaps after sorting." + " \t\tTo compile: javac xxxxxH1.java" + " \t\tTo execute: java xxxxxH1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
