Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLEASE I REALLY NEED HELP Given a sequence of n integer numbers, the task is to implement the Quick-sort algorithm in parallel using C++ and

PLEASE I REALLY NEED HELP

Given a sequence of n integer numbers, the task is to implement the Quick-sort algorithm in parallel using C++ and Open MP, and compare the parallel performance results for various array sizes.

The implementation must be independent of n and the number of processors p to be used, thus, n and p must be input parameters.

Your code should be able to dynamically get number of processors in the system that is running the code and assigns number of threads equivalent up to the number of cores in the system.

Data Generation:

Must be parallized! Randomly generate your sequence of integers in a vector. Vector size will be 10,000, 100,000 , 1,000,000, 10,000,000, and 100,000,000 Be aware of your systems limits. You can test your systems limits for your maximum allowable int vector size and populate it accordingly:

std::vectorv;

//In my PC I got SIZE= 1073741823

std::cout<<" SIZE= "<

for(long long i=0;i<1000000000;i++)

{

v.push_back(int(i));

}

If you get run time error and program crashes, that means you are exceeding your memory/array index limits.

Pivot selection strategies for Quick-sort.

For the numerical tests,you are required to implement one the following pivot strategies(Bonus: If you implement all). You are required to parallelize pivot selection strategy you selected to implement (If you want to get bonus points all pivot selection strategies should be implemented in parallel fashion)

1.Always choose 1st element.

2.Always choose last element as pivot.

3.Choose median of array as pivot(can be chosen in linear time).

4.Choose random element as pivot.

5. Select the median as pivot. One of the pivot selection strategies may be better performing than others.

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

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

Recommended Textbook for

Time Series Databases New Ways To Store And Access Data

Authors: Ted Dunning, Ellen Friedman

1st Edition

1491914726, 978-1491914724

More Books

Students also viewed these Databases questions