3033 - 2024_DS_Summer_Lab2 Scoreboard

Time

2024/07/03 13:00:00 2024/07/19 13:00:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
14223 Lab2_Merge Sort Problem

14223 - Lab2_Merge Sort Problem   

Description

Given an integer array a1,a2,⋯ ,an with n integers, sort the array in non-ascending order using merge sort. Output the sorted array.

Input

The first line is an integer n, being the size of the integer array.The second line contains nn integers a1,a2,⋯ ,an​, being the elements of the integer array.

Constraints

Output

Output the sorted array in one line.

Please append a space after each number, and add a newline at the end of the output.

void merge();
//merge two sorted array
 
void merge_sort();
//divide and conquer
 
int main() {
    /*
    int n;
    cin >> n;
    ...
    Read the input file
    */
 
    /*
    Using merge_sort method to sort your array
    */
 
    /*
    Output the sorted array
    for(int i = 0; i < arr.size(); i++) {
        cout << arr[i] << ' ';
    }
    cout << endl;
    */
}

 

Sample Input  Download

Sample Output  Download

Tags




Discuss