Skip to content
CampusEduX

Merge Sort

Mediumjavapythonccppjavascript

Sort an integer array in ascending order using the Merge Sort algorithm — split the array, sort each half, then merge the sorted halves. The judge checks the final sorted output.

Input Format

The first line contains an integer N. The second line contains N space-separated integers.

Output Format

Print the N integers in ascending order, separated by single spaces, on one line.

Related Problems

  • Quick Sort
    Medium · java, python, c, cpp, javascript
    Solve Problem
  • Kth Smallest Element
    Medium · java, python, c, cpp, javascript
    Solve Problem
  • Kth Largest Element
    Medium · java, python, c, cpp, javascript
    Solve Problem

Input (stdin)

Output

Run your code to see output here...