<p>Please, provide code examples in a language of your choice.</p>

<p><strong>Update</strong>:
No constraints set on external storage.</p>

<p>Example: Integers are received/sent via network. There is a sufficient space on local disk for intermediate results.</p>

1 million 32-bit integers = 4 MB of memory.
You should sort them using some algorithm that uses external storage. Mergesort, for example.