def selection_sort(A):
n = len(A)
for i in range(n):
min_index = i
for j in range(i + 1, n):
if A[j] < A[min_index]:
min_index = j
# Swap the found minimum element with the first element
A[i], A[min_index] = A[min_index], A[i]
return A
def bubble_sort(A):
n = len(A)
for i in range(n):
for j in range(n - 1, i, -1):
if A[j - 1] > A[j]:
# Swap adjacent elements
A[j - 1], A[j] = A[j], A[j - 1]
return A