Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spatial Database Systems Design Implementation And Project Management

Authors: Albert K.W. Yeung, G. Brent Hall

1st Edition

1402053932, 978-1402053931

More Books

Students also viewed these Databases questions

Question

Explain the function and purpose of the Job Level Table.

Answered: 1 week ago