/* 选择排序 */
def selection_sort(list):
# Loop through the entire array
for curPos in range( len(list) ):
# Find the position that has the smallest number
# Start with the current position
minPos = curPos
# Scan right
for scanPos in range(curPos+1, len(list) ):
# Is this position smallest?
if list[scanPos] < list[minPos]:
# It is, mark this position as the smallest
minPos = scanPos
# Swap the two values
temp = list[minPos]
list[minPos] = list[curPos]
list[curPos] = temp