Write a program that sorts a 50-element array using the selectionsort, the bubbl
ID: 3619130 • Letter: W
Question
Write a program that sorts a 50-element array using the selectionsort, the bubble sort, and the insertion sort. Each sort is to beexecuted twice.a) For the first sort, fill the array with random numbers between 1and 1000.
b) For the second sort, fill the array with a nearly ordered list.Create the nearly ordered list by filling the array with sequentialnumbers and then subtracting 5 from every 10th number in thearray.
c) Each sort (selection, bubble, insertion) is to sort the samedata. For each sort, count the number of comparisons and movesnecessary to order the list.
d) After each sort execution, print the unsorted data following bythe sort data in 5-by-10 matrixes (5 rows of 10 numbers each).After the sorted data, print the number of comparisons and movesnecessary to order the data. Provide appropriate headings for eachprintout.
e) To make sure your statistics are as accurate as possible, youmust analyze each loop limit condition test and each selectionstatement in your sort functions. The best way to count them iswith a comma expression, as shown below. Use similar code for theselection statements.
while((count++, a) && (count++, b))