Question: Write a well-documented, Python program, hmwk3Q4.py that implements the Bubble-Sort algorithm. Bubble-Sort iterates over a list of numbers, comparing the elements in pairs and swaps

Write a well-documented, Python program, hmwk3Q4.py that implements the Bubble-Sort algorithm. Bubble-Sort iterates over a list of numbers, comparing the elements in pairs and swaps them - if the first element in the pair is larger than the second. Swapping continues until the largest number "bubbles" to the top of the list, while the smallest element stays at the bottom. Implement the algorithm that accepts an unsorted list and returns a sorted one - in ascending order. Hints: Convince yourself that the algorithm and Python implementation is correct by calling the sorting function with a list [50,20,10,80,40], and printing the sorted result. Your algorithm should use a while-loop to ensure that the ascending order is achieved
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
