Question: I need help to solve this problem. Now your lecturer believes that he has found a new and much better recursive version of this. The

I need help to solve this problem.

I need help to solve this problem. Now your lecturer believes that

Now your lecturer believes that he has found a new and much better recursive version of this. The algorithm for

void superInnstikk (int [] a, int v, int h) { .. .. } is: If the length of the sort you want to sort is longer than 200 then you only call SuperInnstance recursively twice with each and every same half of the area a [v..h] (if the length is an odd number, the two parts will only be almost as long, but it does not matter). If the length of the range to be sorted is

3a) (20%) Type sequential Java code for this recursive algorithm. (to sort an array a [], the method is called this: superInnstance (a, 0, a.length1);)

3b) (3%) Explain why this really sorts a [] and justify which order O () in driving time this algorithm has.

3c) (5%) A slight improvement in the algorithm is how the insertion of a new element in the left is done - we can eventually do this a bit faster during the insertion in the left. Type Java code for this.

3d) (7%) Explain, do not write code for how you can easily parallelize this algorithm.

void insertSort(int [] a, int v, int h) int i, t; for (int k = v ; k h; k++) t = a(k+1] ; if (a[k] t) i = k; while (1-v && a[i] t) { 1 // end insertSort

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!