From the course: Parallel and Concurrent Programming with C++ Part 2

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Challenge: Merge sort

Challenge: Merge sort - C++ Tutorial

From the course: Parallel and Concurrent Programming with C++ Part 2

Start my 1-month free trial

Challenge: Merge sort

(upbeat music) - [Instructor] For our second challenge problem, your goal will be to design and build a parallel version of a classic merge sort algorithm to sort an array of random integers. Merge Sort is a well known divide, and conquer algorithm for sorting the elements in an array. During the divide phase, it recursively splits the input array into two halves referred to as the left half, and the right half. From there the merge phase repeatedly mergers those sorted sub arrays to produce new larger sorted sub arrays. And it continues until there's only one sub array remaining, which is the final sorted result. To give you a starting point for this challenge, we've already implemented a sequential version of the a Merge Sort algorithm in this example program. The sequential Merge Sort function on line 10 takes an appointor to the array of integers that we want to be sorted, along with the arguments for the first and…

Contents