Question

for the following array 30 5 40 11 20 9 15 2 60 25 80 3...

for the following array

30 5 40 11 20 9 15 2 60 25 80 3 73 35 4 75 20 6

  1. Show the new array after each pass of Merge sort.
  2. Show the new array after each pass of Quick sort.

Homework Answers

Answer #1

ARRAY AFTER EACH PASS IS GIVEN IN UNDERLINE

A.) MERGE SORT

30 5 40 11 20 9 15 2 60 25 80 3 73 35 4 75 20 6(DIVIDED INTO TWO HALVES)

PASS 1 :30 5 40 11 20 9 15 2 60 25 80 3 73 35 4 75 20 6

PASS 2 :30 5 40 11 20 9 15 2 60 25 80 3 73 35 4 75 20 6

PASS 3 :30 5 40 11 20 9 15 2 60 25 80 3 73 35 4 75 20 6

PASS 4 :30 5 40 11 20 9 15 2 60 25 80 3 73 35 4 75 20 6

PASS 5 :30 5   40 11 20 9 15 2 60   25 80 3 73 35 4 75 20 6

PASS 6 :5 30 40 11 9 20 2 15 60 25 80 3 73 4 35 20 75 6

PASS 7 :5 11 30 40 2 9 15 20   60 3 25 80 73 4 20 35 75 6

PASS 8 :2 5 9 11 15 20 30 40 60 3 4 20 25 35 73 75 80 6

PASS 9 :2 5 9 11 15 20 30 40 60 3 4 6 20 25 35 73 75 80

PASS 10 : 2 3 4 5 6 9 11 15 20 20 25 30 35 40 60 73 75 80

B) QUICK SORT(PIVOT IS TAKEN AS THE LAST ELEMENT)

30 5 40 11 20 9 15 2 60 25 80 3 73 35 4 75 20 6

PASS 1 :5 2 3 4 6 30 40 11 20 9 15 60 25 80 73 35 75 20

PASS 2 :2 3 4 5 6 11 20 9 15 20   25 30 40 60 80 73 35 75

PASS 3 :2 3 4 5 6 11 9 15 20 20 25 30 40 60 73 35 75 80

PASS 4 :2 3 4 5 6 9 11 15 20 20 25 30 35 40 60 73 75 80

PASS 5 :2 3 4 5 6 9 11 15 20 20 25 30 35 40 60 73 75 80

  

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Given the following unordered array: [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]...
Given the following unordered array: [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] W X D T P N R Q K M E If the array was being sorted using the SHELL sort and the halving method, and sorting into ASCENDING order as demonstrated in the course content, list the letters in the resulting array, in order AFTER the FIRST pass. [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]
1.) Generate an array of 10 random numbers between 1 - 100 2.) Copy the array...
1.) Generate an array of 10 random numbers between 1 - 100 2.) Copy the array to a temp array 3.) Call each of the methods to sort (bubble, selection, insertion, quick, merge), passing it the array 4.) In-between the calls, you are going to refresh the array to the original numbers. 5.) Inside of each sorting method, you are going to obtain the nanoseconds time, before and after the method Subtract the before time from the after time to...
Given the array-based list (20, 30, 40, 50), what will the new array look like after...
Given the array-based list (20, 30, 40, 50), what will the new array look like after the following operations? ArrayListPrepend(list, 10) ArrayListAppend(list, 25) ArrayListRemoveAt(list, 3) ArrayListPrepend(list, 40) ArrayListRemoveAt(list, 3) Show your work on your trace file.
Consider the following sequence of numbers 8, 1, 11, 4, 2, 9, 10, 5, 3, 12,...
Consider the following sequence of numbers 8, 1, 11, 4, 2, 9, 10, 5, 3, 12, 6, 7 c) Sort the list using quick sort with the middle element as pivot. Show the state of the list after each call to the partition procedure. You are not required to write code for this question. You need to trace through the different sorting algorithms using the given list. Please could I get an answer to the above question through using 9...
Part 4: Merge Sort Q7. Arrange the following arrays in ascending order using Merge sort. Show...
Part 4: Merge Sort Q7. Arrange the following arrays in ascending order using Merge sort. Show all steps. 7          11        2          9          5          14 Q8. State the number of sub-arrays for each pass. Pass Split # sub-arrays 1st 2nd 3rd Pass Merge # sub-arrays 1st 2nd 3rd Part 5: Quick Sort Q9. Sort the following unordered list using quicksort. Assume that the pivot you use is always the lastelement. Show all steps. 7          11        2          9          5          14 Cross Over => swap pivot with?   Swap with Low (pivot last element)...
x 5 8 11 3 2 12 y 30 25 20 50 60 67 Find r...
x 5 8 11 3 2 12 y 30 25 20 50 60 67 Find r and the equation of the linear regression line. (hundredths place).
4, 6, 12, 2, 8, 9, 11, 15, 20, 25 Please answer the following question using...
4, 6, 12, 2, 8, 9, 11, 15, 20, 25 Please answer the following question using the above data set: 1. What is the predicted population standard deviation? 2. Draw and superimpose a bell curve and label your data up to 3 standard deviation units from the mean. Use the standard deviation for the data set. 3. Is the above data set more or less variable than a data set that has a standard deviation of 7.25? 4. Is the...
exhibit 24-7 Price Quantity Total Cost $10 10 $80 9 15   85 8 20   95 7...
exhibit 24-7 Price Quantity Total Cost $10 10 $80 9 15   85 8 20   95 7 25   110 6 30   140 5 35   175 4 40   215 30.) Refer to Exhibit 24-7. A monopolistic competitive firm that seeks to maximize profits by selling how many units at what price? What will be the total profit at the profit maximizing level? You must show all work to receive credit.
Giving an array of integers A[1:8] ={5, 1, 3, 2, 7, 6, 8, 4}. Build a...
Giving an array of integers A[1:8] ={5, 1, 3, 2, 7, 6, 8, 4}. Build a MAX-HEAP on A. Show the steps using binary tree representation or array view. Use heap sort: show the array after the first, the second, and the third of heap sort
The data collection is conducted by randomly selecting 51 persons whose ages are between 25-30 and...
The data collection is conducted by randomly selecting 51 persons whose ages are between 25-30 and interviewing the average time they spend on Instagram in a day. What is the probability that people ages between 25-30 spend time using Instagram for more than one hour in a day? I need a PMF equation The collected data: Number of Person Time Number of Person Time Number of Person Time Number of Person Time 1 120 14 90 26 120 39 70...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT