Write Python Function Bubble Sort Q37135505

Write a python function that will do bubble sort


Solution


def bubbleSort(list): needNextPass = True k = 1 while k < len(list) and needNextPass: # List may be sorted and next pass not needed needNextPass = False for i in range(len(list) – k): if list[i] > list[i + 1]:

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.