name of a sorting algorithm
ramit.prasad at jpmorgan.com
Tue Feb 14 10:50:14 EST 2012
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 what Wikipedia says a selection sort is: put the least element in , the least of the remaining elements in , etc.
If your only requirement to match to selection sort is the end result, then every sort would be selection sort. If you meant "put the least element in  in the first pass" then that would indeed be selection sort, but that is not what the above code does. The above code is bubble sort.
Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology
712 Main Street | Houston, TX 77002
work phone: 713 - 216 - 5423
This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.
More information about the Python-list