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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started