Skip to content

Latest commit

 

History

History
24 lines (13 loc) · 792 Bytes

File metadata and controls

24 lines (13 loc) · 792 Bytes

Code Challenge 27: Merge Sort

Challenge Description

Implement a merge sort method to sort a numbered array.

Approach & Efficiency

Divide and Conquer. Use a recursive function to split the array in half until the lengths are 1. Then start comparing the left and right array starting from the first index. Reassign the first index depending on which out of the left and right array has the lower value. Then move to the next index and check the remaining values from the left and right array.

Time: O(n * Log n) Space: O(n)

Solution

Visual