Question: Rank sort is a sorting technique that counts the number of numbers that are smaller than each selected number. The count provides the position of

Rank sort is a sorting technique that counts the number of numbers that are smaller than each selected number. The count provides the position of selected number in the sorted list; that is, its rank. Thus, a[0] is read and compared with each of the other numbers, a[1] . . . a[n-1], recording the number of numbers less than a[0]. Suppose this number is x. This is the index of the location in the final sorted list. The number a[0] is copied into the final sorted list b[0] . . . b[n 1], at location b[x]. Actions repeated with the other numbers. The algorithm has an overall sorting time complexity of O(n2).

(a) Write a sequential function for the Rank Sort using C.

(b) Write a parallel program using openMP for ranksort. Give clear comments explaining the code. Analyze the code and discuss the speed up attained. Is it worth it?

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!