Bubble Sort
Question (LC.463)
Key Idea
Debug
def sortIntegers(self, A: List[int]) -> None:
"""
Bubbling up the current element to the end of the list is also an option.
"""
n = len(A)
for i in range(n):
for j in range(i, n-1):
if A[j] > A[j+1]:
temp = A[j]
A[j] = A[j+1]
A[j+1] = tempCode
Time & Space Complexity
Optimization
Last updated