MERGSORT - Mergesort

no tags 

Simple. Sort the numbers on the standard input using the merge sort algorithm. Don't try to cheat by just calling your build in functions... I can see your source.

Input

On the standard input you will receive N (1 <= N <= 100000). Each number will fit in 32-bit integer

Output

Output the same integers in a sorted manner. Smallest to largest.

Example

Input:
7 3 2 5 4 3

Output:
2 3 3 4 5 7

hide comments
greeshma_2004: 2024-06-17 09:38:05

here should we have to give input or it wil automatically takee

guilb8600k: 2021-08-30 19:17:05

I was getting the "Missing testcases: 'NoneT" error last week, I just submitted the same code today again and It worked!

Robert Lewon: 2021-08-30 13:44:16

The "Missing testcases: 'NoneT" should no longer happen.

Jean-Ralph Aviles: 2021-08-22 10:19:37

I get Missing testcases: 'NoneT. Anyone know what that means?

Andy: 2019-01-25 12:16:20

easy

singhks: 2018-05-29 08:49:47

I used mergesort and used " while( scanf("%d",&n) != EOF ) { a[i++] = n ; } " to take input
still getting TLE. can anyone help

teracoder: 2016-11-09 16:44:40

Can I use my own QuickSort?

darkhire21: 2015-08-19 20:53:00

Those who using EOF carefully It do not work on console . It work with file input like online judges like spoj .

Last edit: 2015-11-20 14:35:11
Rafiq: 2014-12-10 13:28:34

Runtime error why ?

TIGM: 2014-06-15 19:24:17

good for learning merge sort :)


Added by:Nikola P Borisov
Date:2008-11-17
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ERL JS-RHINO NODEJS PERL6 VB.NET