Jabba Laci wrote: > 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 in xrange (N-1): for j in xrange (i, N): if a[j] < a[i]: a[i], a[j] = a[j], a[i] > > It's so simple that it's not mentioned anywhere. I guess it's called > "selection sort" but I'm not sure. The minimum selection sort is an > improvement of this one.
It's what Wikipedia says a selection sort is: put the least element in [0], the least of the remaining elements in [1], etc. Mel. -- http://mail.python.org/mailman/listinfo/python-list