Question

In: Computer Science

Sort the list A[ ]={ 20, 13,4, 34, 5, 15, 90, 100, 75, 102, 112, 1}...

  1. Sort the list A[ ]={ 20, 13,4, 34, 5, 15, 90, 100, 75, 102, 112, 1} using Insertion Sort and determine the total number of comparisons made (do not count swaps)

b.Sort the list stated in 5a) but using Merge Sort

Solutions

Expert Solution

Q1:

(a)

Sol: Below is the image depicting the number of comparisons at each pass and the total number of comparisons:

(b)

Sol: Below is the image depicting the use of merge sort for sorting the array:

(Thank You!, please consider upvoting if it was helpful!)


Related Solutions

a. Sort the list A[ ]={ 20, 13,4, 34, 5, 15, 90, 100, 75, 102, 112,...
a. Sort the list A[ ]={ 20, 13,4, 34, 5, 15, 90, 100, 75, 102, 112, 1} using Insertion Sort and determine the total number of comparisons made (do not count swaps) b. Sort the list stated in 5a) but using Merge Sort
Final_exam assignment_grade Tutorial_attend 100 90 5 100 75 5 90 75 5 85 85 5 85...
Final_exam assignment_grade Tutorial_attend 100 90 5 100 75 5 90 75 5 85 85 5 85 100 5 80 95 5 70 80 5 60 95 5 60 80 5 55 95 5 55 25 4 50 80 5 45 90 5 40 65 5 40 65 4 35 0 3 30 70 4 30 55 4 25 85 5 25 90 4 15 5 3 15 80 5 15 50 5 15 45 3 5 75 3 5 70...
10? + 50? + 20? + 10? = 100 5? + 15? + 75? − 25?...
10? + 50? + 20? + 10? = 100 5? + 15? + 75? − 25? = 200 25a − 15? − 5? = 300 10? + 20? − 30? + 100? = 400 how to do flowchart using gauss elimination and lu decomposition method
10? + 50? + 20? + 10? = 100 5? + 15? + 75? − 25?...
10? + 50? + 20? + 10? = 100 5? + 15? + 75? − 25? = 200 25a − 15? − 5? = 300 10? + 20? − 30? + 100? = 400 how to write coding in matlab using lu decomposition
Sort 33, 77, 22, 11, 34, 21, 88, 90, 42 using Selection sort and shell sort....
Sort 33, 77, 22, 11, 34, 21, 88, 90, 42 using Selection sort and shell sort. Write the algorithms. show work. please
Consider a list called A: A = [-6, 10, 100, 5, -20, 1000, 9, -15] Make...
Consider a list called A: A = [-6, 10, 100, 5, -20, 1000, 9, -15] Make a for loop that iterates over A and: If number is negative, print the square of the number. if number is positive but less than or equal to 100, print the number itself. if number is positive but greater than 100, print 0.
Sort 33, 77, 22, 11, 34, 21, 88, 90, 42 using Quick sort. Write the algorithm....
Sort 33, 77, 22, 11, 34, 21, 88, 90, 42 using Quick sort. Write the algorithm. show work
Sort 33, 77, 22, 11, 34, 21, 88, 90, 42 using Bubble sort, show work. Write...
Sort 33, 77, 22, 11, 34, 21, 88, 90, 42 using Bubble sort, show work. Write the algorithm.
Given: Butter Guns MC 0 100 1 90 2 75 3 55 4 30 5 0...
Given: Butter Guns MC 0 100 1 90 2 75 3 55 4 30 5 0 Complete the marginal cost column (MC). Identify the opportunity cost increasing butter production from 1 to 2 units on the graph. Graphically illustrate the Keynesian versus classical position of the economy and their respective opportunity costs (two graphs). Explain the policy implications of these two alternative assumptions of the economy (Per lesson notes).
investment poor average good A 50 75 20 B 80 15 40 C -100 300 50...
investment poor average good A 50 75 20 B 80 15 40 C -100 300 50 Maximax, Maximin, Minimax Regreat, Hurxicz 0.4, Equal liklihood
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT