(a) Given the following AVL tree 7: 24 (i) (ii) (iii) 30 37 38 42 48...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
(a) Given the following AVL tree 7: 24 (i) (ii) (iii) 30 37 38 42 48 60 89 We will insert several keys into T. For each part of this question, show ALL steps for each insertion, including the trees after each appropriate rotation and the resulting trees after each insertion. Based on the given AVL tree, insert 40 into the AVL tree. Based on the AVL tree in (i), insert 99 into the AVL tree. Based on the AVL tree in (ii), insert 45 into the AVL tree. (4 marks) (3 marks) (4 marks) (b) Is the array with values [1,3,7,9,10,21,13,44,99,10,10,20] a min-heap? If yes, explain why. If no, state clearly ALL the index(s) of the array element(s) that make(s) the array not a min-heap. (4 marks) (c) Draw the resulting tree and array after calling max_heapify (input-a, index=0) on the array a [1,12,11,5,6,9,8,4,3,2,0] where the function would heapify the input array from the index. Note that the function max_heapify assumes the index of the first element is 0. (5 marks) (a) Given the following AVL tree 7: 24 (i) (ii) (iii) 30 37 38 42 48 60 89 We will insert several keys into T. For each part of this question, show ALL steps for each insertion, including the trees after each appropriate rotation and the resulting trees after each insertion. Based on the given AVL tree, insert 40 into the AVL tree. Based on the AVL tree in (i), insert 99 into the AVL tree. Based on the AVL tree in (ii), insert 45 into the AVL tree. (4 marks) (3 marks) (4 marks) (b) Is the array with values [1,3,7,9,10,21,13,44,99,10,10,20] a min-heap? If yes, explain why. If no, state clearly ALL the index(s) of the array element(s) that make(s) the array not a min-heap. (4 marks) (c) Draw the resulting tree and array after calling max_heapify (input-a, index=0) on the array a [1,12,11,5,6,9,8,4,3,2,0] where the function would heapify the input array from the index. Note that the function max_heapify assumes the index of the first element is 0. (5 marks)
Expert Answer:
Answer rating: 100% (QA)
a i Insert 40 into the AVL tree Initial tree 37 24 48 7 30 42 60 ... View the full answer
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
The following additional information is available for the Dr. Ivan and Irene Incisor family from Chapters 1-5. Ivan's grandfather died and left a portfolio of municipal bonds. In 2012, they pay Ivan...
-
The following additional information is available for the Dr. Ivan and Irene Incisor family from Chapters 1-6. On December 12, Irene purchased the building where her store is located. She paid...
-
The following data represent the prices in dollars of general admission tickets for the last 18 concerts at one venue. Use the given data to determine the stems for this stem-and-leaf plot. $50 $61...
-
Each function described below models the specified data for the years 2006 through 2016, with t = 6 corresponding to 2006. Estimate a reasonable scale for the vertical axis (e.g., hundreds,...
-
One of Googles largest acquisitions was Motorola Mobility for $12.5 billion in 2011. Google subsequently sold Motorola to Chinese giant PC producer Lenovo for $2.9 billion. Required Explain how...
-
Consider figure P8.43. Let the inertia of the block on the table be \(M\) and that of the hanging bock be \(M / 4\). If the coefficient of kinetic friction between the table and the block is 0.2 ,...
-
D-List Calendar Co. specializes in manufacturing calendars that depict obscure comedians. The company uses a standard cost system to control its costs. During one month of operations, the direct...
-
16. 17. The IUPAC nomenclature of an element with electronic configuration [Rn] 5f46d17s is: (a) Unnibium (b) Unnilunium (c) Unnilquandium (d) Unniltrium The compound(s) that is (are) removed as slag...
-
Wayland Custom Woodworking is a firm that manufactures custom cabinets and woodwork for business and residential customers. Students will have the opportunity to establish payroll records and to...
-
Aaron sells property with a basis of $300,000 and a FMV of $800,000. In the sale, he incurs $100,000 of selling expenses. He receives a $400,000 note, $100,000 installments from year 1 through 4. He...
-
Who invest not less than US$500,000 in the Multi Facility Economic Zones (MFEZ) or a priority sector or product under the ZDA Act, are entitled to one of the following fiscal incentives?
-
A contracted fee schedule has been agreed to by a Provider with an Insurance Company. In this example, a service is $250 per the Provider's fee schedule. The contracted amount is $200.Can the...
-
As a wholesaler, Hadina not only stocks the products but provides credit, delivers the products, and helps price and sell he products. What type of wholesaler is she?
-
How do resource utilization patterns and reallocation of resources relate to student performance?Items to consider in your discussion are why we reallocate resources and how do we reallocate so it...
-
A nonprofit offers you an internship with no pay, but will pay off your student debt today valued at $77,000 (assume no interest will accumulate on it over the next two years). Will you accept the...
-
A 3.8% bond matures in 9 years. The bond pays coupons semiannually, and has a YTM of 3.8%. The price of the bond is $ Do not round any intermediate work. Round your *final* answer to 2 decimal places...
-
Is the modified 5-question approach to ethical decision making superior to the modified moral standards or modified Past in approach?
-
Deborah purchases a new $30,000 car in 2012 to use exclusively in her business. If Deborah does not elect to expense or take bonus depreciation in 2012 and holds the car until it is fully...
-
Mike sells his home to Jane on April 2, 2012. Jane pays the property taxes covering the full calendar year in October, which amount to $2,500. How much may Mike and Jane each deduct for property...
-
During the 2012 tax year, Irma incurred the following expenses: Union dues..............................................................$275 Tax return preparation...
-
The treatment of outflows on account of dividend and interest is highly debatable as to their activity classification. Give a serious thought to the issue and express your opinion about the best...
-
Consider the same setting as Problem 18, but suppose instead 80% of the shareholders redeem their shares, and no warrants are exercised. Data from problem 18 a. What is the amount of cash per share...
-
Form a small group. Concentrate on BSE Sensex companies and compile the voluntary disclosures made by each of them. Draft a crisp research paper highlighting your findings and use thereof to various...
Study smarter with the SolutionInn App