Question: a . Construct a permutation of 1 1 numbers. Sort the numbers using the sorting algorithms: Bubble Sort, Insertion Sort, Selection Sort and Quick Sort

a. Construct a permutation of 11 numbers. Sort the numbers using the sorting algorithms: Bubble Sort,
Insertion Sort, Selection Sort and Quick Sort as described in the lecture notes. Note that you should not
use different versions of these algorithms.
Assume that the numbers are stored in an array. You should show the contents of the array after each
iteration for all the algorithms.
b. Given an array of n integers in the locations A[1], A[2],..., A[n], describe an O(n2) time algorithm to
compute the products P(i,j)= A[i]*A[i+1]*...* A[j] for all i, j,1<= i < j <= n
(Hint: First try manually a solution with an array of 6 elements, then generalize it to an array with any
size n.)

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 Programming Questions!