#C13991. Merge Sort Implementation
Merge Sort Implementation
Merge Sort Implementation
In this problem, you are required to implement the Merge Sort algorithm. Merge Sort is a classic divide and conquer algorithm which works by recursively splitting an array into two halves until each subarray contains only one element, and then merging the subarrays to produce a sorted array. The time complexity of Merge Sort is \(O(n \log n)\), where \(n\) is the number of elements in the array.
You will be given a list of integers, and your task is to output the sorted list in non-decreasing order.
inputFormat
The input is read from standard input (stdin) and has the following format:
- The first line contains an integer \(n\), representing the number of elements in the array.
- The second line contains \(n\) space-separated integers representing the elements of the array.
outputFormat
The output should be printed to standard output (stdout) as a single line containing the sorted list of integers in non-decreasing order, separated by a single space.
## sample6
34 7 23 32 5 62
5 7 23 32 34 62