From the course: Parallel and Concurrent Programming with Java 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 in Java

Challenge: Merge sort in Java - Java Tutorial

From the course: Parallel and Concurrent Programming with Java 2

Start my 1-month free trial

Challenge: Merge sort in Java

(upbeat techno music) - [Instructor] For our second challenge problem, your goal will be to design and build a parallel version of the 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. That continues until the sub-arrays have been recursively divided down to their smallest unit. Those sub-arrays are considered to be sorted because they only have one element. From there, the merge phase repeatedly merges those sorted sub-arrays to produce new, larger sorted sub-arrays, and it continues doing that until there's only one 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 merge sort algorithm in the example program. The SequentialMergeSorter class has a…

Contents