Am 14.02.2012 16:01, schrieb Jabba Laci:
Could someone please tell me what the following sorting algorithm is called?

Let an array contain the elements a_1, a_2, ..., a_N. Then:

for i = 1 to N-1:
     for j = i+1 to N:
         if a_j<  a_i then swap(a_j, a_i)

It's so simple that it's not mentioned anywhere.

Please do your own homework. This code isn't even Python!


I guess it's called "selection sort" but I'm not sure.

You guessed right.


Uli
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to