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.
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).
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
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.
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...
Period Price Quantity 1 $4.65 33 2 $4.67 30 3 $4.62 35 4 $4.59 40 5...
Period Price Quantity 1 $4.65 33 2 $4.67 30 3 $4.62 35 4 $4.59 40 5 $4.57 43 6 $4.58 40 7 $4.55 50 8 $4.50 52 9 $4.52 49 10 $4.50 53 11 $4.43 57 12 $4.45 55 13 $4.42 59 14 $4.40 64 15 $4.44 60 16 $4.37 70 17 $4.35 72 18 $4.32 75 19 $4.37 80 20 $4.26 88 Given the data provided to you in class, use the regression toll in Excel to perform a...
Using the given data set to answer the following questions80 60 100 40 40 50 80...
Using the given data set to answer the following questions80 60 100 40 40 50 80 90 100 60 10 80 45 60 30 80 30 90 100 60 50 75 a. find Mean, Median, Mode, Standard Deviation, and Variance: b. find First quartile and Third Quartile c. Find the number which represents the 33th percentile. d. find the percentile of 45 e. find the range and midrange f. construct a box-plot g. Construct a frequency distribution with 5 classes....