Commit e33d3680 by BellCodeEditor

auto save

parent f294aeb4
Showing with 27 additions and 0 deletions
# a = [12,51,451,61,584,209,6,2,5]
# length = len(a)
# for i in range(1,length):
# key= a[i]
# j = i-1
# while j >= 0 and a[j] >key:
# a[j+1] = a[j]
# a[j] = key
# j = j-1
# print(a)
a = [12,51,451,61,584,209,6,2,5]
for i in range(0,len(a)):
index = i
for j in range(i+1,len(a)):
if a[j] < a[index]:
index = j
a[i] ,a[index] = a[index],a[i]
print(a)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment