Question: in python Implement these additional sorting algorithms: Quick, Modified Quick, Merge, and Counting. Test your sorting algorithms as you did in the previous assignment. import

in python

in python Implement these additional sorting algorithms: Quick, Modified Quick, Merge, andCounting. Test your sorting algorithms as you did in the previous assignment.import random def get_random_numbers(): randomlist = [] for i in range(0, random.randint(5,10)):n = random.randint(1,30) randomlist.append(n) return randomlist def bubble_sort(randomlist): for i in range(0,

Implement these additional sorting algorithms: Quick, Modified Quick, Merge, and Counting. Test your sorting algorithms as you did in the previous assignment. import random def get_random_numbers(): randomlist = [] for i in range(0, random.randint(5,10)): n = random.randint(1,30) randomlist.append(n) return randomlist def bubble_sort(randomlist): for i in range(0, len(randomlist)-1): for j in range(0, len(randomlist)-i-1): if randomlist[j+1] randomlist[i+1]): randomlist[i], randomlist[i+1] = randomlist[i+1], randomlist[i] swapped = True if (swapped False): break swapped = False end = end-1 for i in range(end-1, start-1, -1): if (randomlist[i] > randomlist[i +1]): randomlist[i], ai + 1] = randomlist[i + 1], randomlist[i] swapped True start start + 1 return randomlist I def main(): print("How many times would you like to test?") number = int(input() for i in range(0, number): randomlist = get_random_numbers() bubble_sort_list = bubble_sort(randomlist) selection_sort_list = selection_sort(randomlist) shaker_sort_list = shaker_sort(randomlist) print("Random Numbers List:" , randomlist) print("Bubble Sort Result:", randomlist) print("selection Sort Result:", randomlist) print("Shaker Sort Result:", randomlist) randomlist.sort() print("Random List vs Bubble Sort Result:", randomlist == bubble_sort_list) print("Random List Vs Selection Sort Result:", randomlist == selection_sort_list) print("Random List Vs Shaker Sort Result:", randomlist == shaker_sort_list) main()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!