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
Srinivas Iyengar: 2009-02-28 07:49:45

Well I guess you have a valid Point. The Author should have asked about the number of swaps or something that was solely related to MergeSort.

Miorel-Lucian Palii: 2009-02-28 06:17:29

By the way, you can see my source, but I can obfuscate it. ;)

Miorel-Lucian Palii: 2009-02-28 06:16:53

As far as I'm concerned, any solution that can get AC is correct. And this holds not just on SPOJ but any programming contest/judge. That's because it's impractical to have humans review every solution manually. It's up to the problem author to craft a problem that can only be solved by the desired algorithm.

Srinivas Iyengar: 2009-02-28 05:52:29

However You Need to be true to yourself at times.You may use Function Calls sort or qsort but then Does it serve the Purpose is the Million-Dollar Question that you need to ask yourself.

Miorel-Lucian Palii: 2009-02-28 05:45:08

It's not feasible for you to manually ensure that submissions are actually implementing 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