## Posts Tagged “algorithm”

Once upon a time, in my early days of programming, an instructor in the computer course wanted to help me improve my programming techniques! She asked me whether I would write a program to sort numbers from 0 to 9 given in mixed order. Then, she went. Perhaps she thought it would take too long.

After thinking a second, or two, I run after her and asked if it would make a difference if I correctly display them on the screen. She, confidently, said “no”.

A few minutes later, I called her to see the result. Although she had a shock, she didn’t even wondered how I did it!

Despite it has nothing to do with the logic of real sorting algorithms, there are many lessons behind it. One is that “the result is more important!” You guess the others…

Here is a C# implementation of that funny sorting algorithm. You may read the real stuff in Wikipedia.

```using System;
using System.Text;

namespace FunnySort
{
class Program
{
static void Main(string[] args)
{
int[] numbers = { 7, 3, 6, 2, 0, 8, 4, 1, 5, 9 };
foreach (int number in numbers)
{
Console.CursorLeft = number * 3;
Console.Write(number);
}