Merge sort and threads

Joined
Aug 16, 2024
Messages
1
Reaction score
0
Hello everyone,
I need to design a parallel merge sort (merge sort algorithm) that operates using threads as follows:

In the first recursion level (merging two arrays of half the size), one thread is used.
In the second recursion level (two merges of two arrays, each a quarter of the size), two threads are used.
In the third recursion level (four merges of two arrays, each an eighth of the size), four threads are used.
And so on.
I must use the threading library and synchronization mechanisms such as mutex and semaphore as needed.
I tried to use chat gpt but I fell like all the answers are wrong.
I will be greatfu for help.

Joe.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,278
Messages
2,571,182
Members
48,780
Latest member
altimist-patrick

Latest Threads

Top