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 - Java Tutorial
From the course: Parallel and Concurrent Programming with Java 2
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
-
(Locked)
Welcome to the challenges39s
-
(Locked)
Challenge: Matrix multiply in Java5m 4s
-
(Locked)
Solution: Matrix multiply in Java6m 20s
-
(Locked)
Challenge: Merge sort in Java4m 34s
-
(Locked)
Solution: Merge sort in Java3m 47s
-
(Locked)
Challenge: Download images in Java2m 34s
-
(Locked)
Solution: Download images in Java4m 3s
-
(Locked)
-