This repository has been archived on 2025-12-15. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
2024-09-20 14:17:13 +03:00

15 lines
323 B
Python

def isort(A):
for i in range(1, len(A)):
j = i-1
while (j >= 0) and (A[j] > A[j+1]):
temp = A[j]
A[j] = A[j+1]
A[j+1] = temp
j = j-1
if __name__ == "__main__":
A = [4, 3, 6, 2, 9, 7, 1, 8, 5]
isort(A)
print(A) # [1, 2, 3, 4, 5, 6, 7, 8, 9]