# Rosetta Code:Village Pump/Unknown sorting algorithm

**Unknown sorting algorithm**

This is a particular discussion thread among many which consider Rosetta Code.

# Summary

Question on what sorting algorithm this is.

# Discussion

Someone know what sorting algorithm is this? I just made it, and i don't know his name (Bogosort, Bubble Sort and etc.)

Take a look at my code:

<lang python>aunsorted = [6, 2, 7, 8, 3, 1, 10, 5, 4, 9] asorted = []

amin = aunsorted[0] aminindex = 0

while True:

for i in range(len(aunsorted)): if aunsorted[i] < amin: amin = aunsorted[i] aminindex = i

del aunsorted[aminindex] asorted = asorted + [amin]

if len(aunsorted) == 0: break

amin = aunsorted[0] aminindex = 0

print asorted</lang>

<lang csharp>using System; using System.Collections.Generic;

public class Program {

static void Main() { List<int> unsorted = new List<int>(new int[] { 6, 2, 7, 8, 3, 1, 10, 5, 4, 9 }); List<int> sorted = new List<int>();

int min = unsorted[0]; int minindex = 0;

while (true) { for (int i = 0; i < unsorted.Count; i++) { if (unsorted[i] < min) { min = unsorted[i]; minindex = i; } }

unsorted.RemoveAt(minindex); sorted.Add(min);

if (unsorted.Count == 0) break;

min = unsorted[0]; minindex = 0; }

foreach (int i in sorted) { Console.WriteLine(i); } }

}</lang>

- This is effectively a selection sort (find minimum, put in the right place). --IanOsgood 02:37, 22 April 2009 (UTC)
- Thanks for a fast answer ;) --Guga360 02:50, 22 April 2009 (UTC)