Skip to content

Latest commit

 

History

History
 
 

Merge_sort

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

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: