Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question: Please help to change the coding from JAVA to C programming language and please help me to correct the coding if the coding is

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

Question: Please help to change the coding from JAVA to C programming language and please help me to correct the coding if the coding is not what the question wants. After you convert the coding from JAVA to C programming, please also provide the screenshot of the output you get. Thank You! In this cwertise you are ashal to: - Implensnt in Java the Qeiclsort algorithm for arnys of imegers. - Implernent in Jasa the Hybrid Quicksort algonithm fer arrays of iategers, a variat of Quickeot that deperals on as adificeal puameler k. The alyorithm work as follons. if the size of the porian of the aray to be soted is greater than k, it recurively calls the Hytrid Quichart methed with the sante k; - If the sixe of the porian of the anay io low woded is less than er equals to k, it sorts that portien by asing the lneiton Sect alyorithm. 20,50,100,,1} and differni aray sises a (0={20,100,1000,100001. Find out fer which values ofk and fie which array sines Hybrial Quiskioan auperform the starshard Cuickient. Drliverable : 1. The eede that you develeped for your eoparimsntai. 2. An analysis for which value of k and for which mmey size a the standand Quickert algonithm starts to eutperform the hybrid cos: 3. A discussion and the possible explanation for the obtained running times. Backgreand: Many implomoniations of rocursive serting algonthes, libe Quickson or Mergesert, actaally implement sach a hybrid version. Hint: Write JavaC: code to make the trials and take the mensurcments, rather than deing it manually with porsil and papar. import java.util.Arrays; import java.util.Random; public class QuickSort \{ // Number of elements to be sorted private static final int n=10000; // Number of sorting runs private static final int k=100; for ( int i=10w+1;i low \& \& arr[j 1]> value ) \{ arr[j]=arr[j1] j; \} // Note that subarray arr[j.i-1-1] is shifted to // the right by one position i.e. arr[j+1.i] arr[j] = value; \} \} public static int Partition (int[] a, int low, int high) \{ // Pick rightmost element as pivot from the array int pivot = a[high]; // elements less than pivot will be pushed to the left of pindex // elements more than pivot will be pushed to the right of plndex // equal elements can go either way int plndex = low; // each time we finds an element less than or equal to pivot, // plndex is incremented and that element would be placed // before the pivot. for (int i= low ;= high ) return; // rearrange the elements across pivot int pivot = Partition( a, low, high); // recur on sub-array containing elements less than pivot QuickSort(a, low, pivot - 1); // recur on sub-array containing elements more than pivot QuickSort(a, pivot +1, high); \} public static void HybridQuickSort(int[] A, int low, int high) \{ while (low

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions