Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

QuickSort using threads in C/C++ Given a large array of integers use C (or C++) AND Pthread APIs to write a parallel program to find

QuickSort using threads in C/C++ Given a large array of integers use C (or C++) AND Pthread APIs to write a parallel program to find the median.

The parallel program must meet the following requirements: - Assume that the entire array is stored initially in a text file.

Your program needs to read all integer values from the input text file and store them in one location.

Then, the entire array is distributed to the different threads for parallel processing.

The format of the input text file is as follows: o The very first line of the input file begins with # and followed by a space character and a number, which indicates how many integer values are stored in the input file.

Adjacent integer values in the input text file is separated by .

The following is the content of a sample input text file called inputFile.txt: # 5 412 324 2 2342 12 5 -

DO NOT assume the size of input data. The number of integer elements in the input data can be as large as 10,000,000.

You will need to allocate a memory space dynamically (e.g., using malloc() in C or new in C++) to store all integers read from the given input file.

The input file name should be provided as a command-line parameter of your program. For example, o %mt_median_finder inputFile.txt

Your program needs to create 4 threads and all four threads should use an exactly same thread function

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

More Books

Students also viewed these Databases questions