Skip to content
This repository was archived by the owner on Nov 26, 2019. It is now read-only.

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

README.md

Merge Sort

Merge sort is an efficient, general-purpose, comparison-based sorting algorithm. Merge sort is a divide and conquer algorithm that was invented by John von Neumann in 1945.It divides input array in two halves, calls itself for the two halves and then merges the two sorted halves.The merge() function is used for merging two halves

Input Format

  • The input consists of two lines.
  • In the first line, there will be a single integer N.
  • In the second line, there will be N space separated integers.

Output Format

  • There will be N space separated integers sorted in increasing order.

Sample Input

8
98 45 34 12 56 67 89 1

Sample Output

1 12 34 45 56 67 89 98

Implemented in:

Python Implementation:

Input Format

The input consists of one lines-

  • Line contains space separated integers which are required to be sorted

Output Format

Space separated integers sorted in non-decreasing order

Sample Input

5 2 4 3 1

Sample Output

1 2 3 4 5

Implemented in: