Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please do this in python 3.8 without numpy Question 4 (10 Points) Write a well-documented, Python program, hmwk324.py that implements the Bubble-Sort algorithm. Bubble-Sort iterates

image text in transcribed

please do this in python 3.8 without numpy

Question 4 (10 Points) Write a well-documented, Python program, hmwk324.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. Initial List 5 4 6 8 2nd Pass Nth Pass 3 5 8 46 Swap 3 4 5 6 8 Swap 5 8 46 Do Not Swap 3 5 4 8 6 Swap 3 5 4 6 8 Swap Bubble Sort Algorithm 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. Grading: Comments (+2 points). Input software to query for a list of N elements (+4 points). A correct while-loop (+4 points)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Algorithmic Trading Navigating The Digital Frontier

Authors: Alex Thompson

1st Edition

B0CHXR6CXX, 979-8223284987

More Books

Students also viewed these Databases questions