[Acua] Consider the following array: 8, 9, 17, 4, 3, 20, 25, 5 Show a trace...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
[Acuña] Consider the following array: 8, 9, 17, 4, 3, 20, 25, 5 Show a trace of execution for top-down mergesort using the method shown in lecture (where both sides are updated at once). Illustrate the contents of the array as it is broken down, and then merged into an ordered state. Enter each subsequent state as a comma separated list (as shown by the initial state). Do not include any spaces or brackets in your answer. If you follow these directions exactly and are marked off by the auto-grader, reach out to the instructional staff. 1 (initial): 8,9,17,4,3,20,25,5 (given as example) 2 (down): 8,9,17,4,3,20,25,5 (given as example; nothing changed!) 3 (down): 4 (mid): 5 (up): 6 (up): 7 (up): Question 2 0.5 pts How (in general) are priority queues related to other sorting algorithms? Both priority queues and the other four sorting algorithms must obey the lower bound proof. Priority queues are more efficient implementation of insertion sort. ○ They both involve comparing elements, and PQs may be used to create a straightforward sorting algorithm. O Priority queues are implementations of the same ADT that the sorting algorithms use. Question 3 1.5 pts [Acuña] Consider the following values: 5, 9, 1, 5, 6, 2, 5, 6, 9, 10. Select a valid binary heap for this data. 5 о 10 10 5 Question 4 [Acuña] Is your answer to the previous question unique? Explain. No - the same nodes can be used to draw multiple valid heaps. Yes - the previous question had only one answer. No - the nodes can also be arranged to fit the BST ordering rule. Yes - these nodes can only be used to draw a specific tree. 1 pts Question 5 1.5 pts [Acuña/Morris] Consider the following priority queue array: [0, 8, 6, 7, 4, 4, 4, 5, 1, 3, 1]. Which of the diagrams below accurately represents it? Remember: The first element of the array is never used. A B C D A B 7 0.5 pts [Acuña] Suppose that you are inserting a node with value 4 into the max PQ show below. When it is initially added, which position (see lettered nodes) does it have in the heap/tree? Question 6 10 5 m 0 O O F О 0 D ய E A О B Question 7 0.5 pts [Acuña] What is the Tilde approximation order of the following code fragment? Assume that you are measuring the number of comparisons (less) and that n represents the number of nodes in the heap. private void sink(int k) { while (2 k < N) { int j = 2*k; if (j < N && less(j, j+1)) j++; if (!less (k, j)) break; exch(k, j); k = j; } ~(logn)^2 ~(1/2)n ~logn Does not exist, or cannot be determined with information given. ~(1/2)logn [Acuña] Consider the following array: 8, 9, 17, 4, 3, 20, 25, 5 Show a trace of execution for top-down mergesort using the method shown in lecture (where both sides are updated at once). Illustrate the contents of the array as it is broken down, and then merged into an ordered state. Enter each subsequent state as a comma separated list (as shown by the initial state). Do not include any spaces or brackets in your answer. If you follow these directions exactly and are marked off by the auto-grader, reach out to the instructional staff. 1 (initial): 8,9,17,4,3,20,25,5 (given as example) 2 (down): 8,9,17,4,3,20,25,5 (given as example; nothing changed!) 3 (down): 4 (mid): 5 (up): 6 (up): 7 (up): Question 2 0.5 pts How (in general) are priority queues related to other sorting algorithms? Both priority queues and the other four sorting algorithms must obey the lower bound proof. Priority queues are more efficient implementation of insertion sort. ○ They both involve comparing elements, and PQs may be used to create a straightforward sorting algorithm. O Priority queues are implementations of the same ADT that the sorting algorithms use. Question 3 1.5 pts [Acuña] Consider the following values: 5, 9, 1, 5, 6, 2, 5, 6, 9, 10. Select a valid binary heap for this data. 5 о 10 10 5 Question 4 [Acuña] Is your answer to the previous question unique? Explain. No - the same nodes can be used to draw multiple valid heaps. Yes - the previous question had only one answer. No - the nodes can also be arranged to fit the BST ordering rule. Yes - these nodes can only be used to draw a specific tree. 1 pts Question 5 1.5 pts [Acuña/Morris] Consider the following priority queue array: [0, 8, 6, 7, 4, 4, 4, 5, 1, 3, 1]. Which of the diagrams below accurately represents it? Remember: The first element of the array is never used. A B C D A B 7 0.5 pts [Acuña] Suppose that you are inserting a node with value 4 into the max PQ show below. When it is initially added, which position (see lettered nodes) does it have in the heap/tree? Question 6 10 5 m 0 O O F О 0 D ய E A О B Question 7 0.5 pts [Acuña] What is the Tilde approximation order of the following code fragment? Assume that you are measuring the number of comparisons (less) and that n represents the number of nodes in the heap. private void sink(int k) { while (2 k < N) { int j = 2*k; if (j < N && less(j, j+1)) j++; if (!less (k, j)) break; exch(k, j); k = j; } ~(logn)^2 ~(1/2)n ~logn Does not exist, or cannot be determined with information given. ~(1/2)logn
Expert Answer:
Answer rating: 100% (QA)
Answer 1 initial 2131637231225 2 down 2131637231225 3 down 2131637231225 4mid 2131637231225 5up 2133... View the full answer
Related Book For
Java Software Structures Designing And Using Data Structures
ISBN: 9780133250121
4th Edition
Authors: John Lewis, Joe Chase
Posted Date:
Students also viewed these programming questions
-
A regular language is a language that can be defined by a regular expression. 0 2 . 1 Complete the unshaded cells of Table 1 to show which of the statements about regular languages are true and which...
-
The following additional information is available for the Dr. Ivan and Irene Incisor family. The Incisors own a rental beach house in Hawaii. The beach house was rented for the full year during 2012...
-
Why dont physicians guarantee their work as do many auto repair shops?
-
Use the Flowell Design Ltd. data from Problem 17-3B. In Problem 17-3B Required 1. Prepare the 2017 cash flow statement by the indirect method. If your instructor also assigned Problem 17-3B, prepare...
-
Harker & Keltner (2001) examined whether emotional well being in later life could be predicted from the facial expressions of 141 women in their college yearbook photos. The predictor variable of...
-
Two trees are \(600 \mathrm{~m}\) apart. You are standing exactly halfway between them and your lab partner is at the base of tree 1. Lightning strikes both trees. a. Your lab partner, based on...
-
SCHEDULE OF COST OF GOODS MANUFACTURED The following information is supplied for Sanchez Welding and Manufacturing Company. Prepare a schedule of cost of goods manufactured for the year ended...
-
"A dividend of $48 was declared during 2021, but was not paid." how would this be reflected on the balance sheet since it was not paid.
-
Which of the following is a positive reason for learning chemistry? (a) Chemistry is relevant to daily life (b) Chemistry offers career opportunities (c) Chemistry studies interesting topics (d)...
-
Given the demand curve of P=60-3Q and a long-run supply curve is perfectly elastic at $4 per unit, what is the output level produced by the competitive industry and what would consumer surplus be?...
-
Nominal GDP Real GDP 2000 9817 9817 2001 10128 9890 2002 10470 10049 2003 10971 10321 2004 11734 10756 Nominal and Real GDP values are in billions of dollars a) Year 2000 is the based year. Find the...
-
Who is generally responsible for providing the accounting department with information n on financing and investment activities n to create the appropriate journal entries in the general ledger?
-
After we make our initial sourcing decision based on the lowest total (landed) cost, we get hit with unexpected supply chain disruption which clogs the port of Long Beach and delays shipments adding...
-
Choose in the news a case study related to a consumer company facing ethical challenges in procurement. For example: Electric vehicles facing claims of child labor in lithium mines; Mobile phones...
-
The top managers of Evergreen Products of East Lansing, MI, have asked you to act as a consultant on a problem plaguing the entire company. Evergreen Products manufactures decorated containers and...
-
Use the standard normal distribution or the t-distribution to construct a 90% confidence interval for the population mean. Justify your decision. If neither distribution can be used, explain why....
-
Use the information given about the angles and to find the exact value of: (a) sin( + ) (b) cos( + ) (c) sin( - ) (d) tan ( + ) (e) sin(2) (f) cos (2) (g) sin /2 (h) cos/2 cos = 4/5, 0 < < /2; cos =...
-
Arrange the growth functions of the previous exercise in ascending order of efficiency for n = 10 and again for n = 1,000,000.
-
Create a limited airline scheduling system that will allow a user to enter city to-city connections and their prices. Your system should then allow a user to enter two cities and should return the...
-
Create an implementation of a 2-4 tree using the array strategy discussed in Section 14.5.
-
With the availability of free credit reports, consumers are encouraged to check their report every 4 months-one report from each of the three major bureaus. In the past, consumers also were...
-
A leading financial publication reported that the average baby boomer credit user will pay approximately $1,200 in interest annually. If, instead of paying interest, this amount was saved every year,...
-
Some credit card issuers are beginning to assess fees and other charges on convenience users. Ask your friends and peers if they think a convenience credit card user should be charged for the...
Study smarter with the SolutionInn App