Question

In: Computer Science

Please answer full question thoroughly (A- D) showing detailed work. SUBMIT ORIGINAL work and ensure it...

Please answer full question thoroughly (A- D) showing detailed work. SUBMIT ORIGINAL work and ensure it is correct for thumbs up.

a) Show that an n-element heap has height  

b) Show that in any subtree of a max-heap, the root of the subtree contains the largest value occurring anywhere in that subtree.

c) Where in a max-heap might the smallest element reside, assuming that all elements are distinct?

d) Show that, with the array representation for storing an n-element heap, the leaves are the nodes indexed by  

Solutions

Expert Solution

a).

In this n element is an heap and heap is a tree and heap is satisfy there all the properties are:In their all the child nodes are less and greter than its parent node for a min type heap.

The leaves of a heap fill the h or h-1 node.

Height of heap = O(n).

b).

Assume that the root of sub tree is same position a[i].

The max heap property = A[i] >=A[j=2i].

In case if node i is left child and A[i] >= A[k = 2*i+1], if node i its right sub tree.

But A[j] >=A[2j] if in case j node is left child and A[k] >= A[2k+1].

In case k node is left child and A[K] >= A[2*K+1] if k node is a right sub tree and this steps are followed continous.

Hence A[i], in this the root of the sub tree is greater than the value of any child in the sub tree .so that it contains larger value in the subtree.

c).

The max heap property that is node's value is greater than the child nodes value and the maximum element it will be become the root node.


Related Solutions

Please answer full question thoroughly (A- D) showing detailed work. SUBMIT ORIGINAL work and ensure it...
Please answer full question thoroughly (A- D) showing detailed work. SUBMIT ORIGINAL work and ensure it is correct for thumbs up. a) What is the effect of calling MAX-HEAPIFY(A, i) when the element A[I ]is larger than its children? b) What is the effect of calling MAX-HEAPIFY(A, i) for i > A.heap-size/2? c) The code for MAX-HEAPIFYis quite efficient in terms of constant factors, except possibly for the recursive call in line 10, which might cause some compilers to produce...
Please answer below question with full detailed explanation in type written, no hand writing please. What...
Please answer below question with full detailed explanation in type written, no hand writing please. What is the basic difference between synchronous machine and induction machine? Why induction motor is more common as compared to induction generator?
Please answer the following by hand showing all arithmatic and original formulas, please do not use...
Please answer the following by hand showing all arithmatic and original formulas, please do not use a graphic calculator. The province of Ontario is planning to construct a new hydropower plant to help make energy prices more affordable, as well as to support improved public health and environmental quality. The construction of the hydropower plant will start by the beginning of 2023 and will take 3 years at a cost of $200 million per year. The cost of maintenance and...
Answer the following questions showing all work. Full credit will not be given to answers without...
Answer the following questions showing all work. Full credit will not be given to answers without work shown. If you use Minitab Express or StatKey include the appropriate output (copy + paste). If you do hand calculations show your work using the Word equation editor. Clearly identify your final answers. Output without explanation will not receive full credit and answers with no output or explanation will not receive full credit. Round all answers to 3 decimal places. If you have...
Answer the following questions showing all work. Full credit will not be given to answers without...
Answer the following questions showing all work. Full credit will not be given to answers without work shown. If you use Minitab Express or StatKey include the appropriate output (copy + paste). If you do any hand calculations show your work using the Word equation editor. Clearly identify your final answers. Output without explanation will not receive full credit and answers with no output or explanation will not receive full credit. Round all answers to 3 decimal places. If you...
PLEASE READ: This is one question with 3 parts to it, please answer the full question....
PLEASE READ: This is one question with 3 parts to it, please answer the full question. Mark M. Upp has just been fired as the university bookstore manager for setting prices too low (only 20 percent above suggest retail). He is considering opening a competing bookstore near the campus, and he has begun an analysis of the situation. There are two possible sites under consideration. One is relatively small, while the other is large. If he opens at Site 1...
Do your best to answer each question thoroughly and provide examples for full credit. (Most of...
Do your best to answer each question thoroughly and provide examples for full credit. (Most of the answers are in the links provided & change control lecture in D2L) Q1. Illustrate how can we control 'change requests' coming from different directions during a project? (follow the six Steps in the Change Control Process) Q2. a. What are the sources of change? b. Discuss- If a change is agreed upon, what may be the impacts of this change to the project...
please be DETAILED with the answers! this is a ruminant nutrition question do not answer if...
please be DETAILED with the answers! this is a ruminant nutrition question do not answer if unsure A complete dairy diet contains 55% alfalfa, 40% corn and 5% cotton seed meal. List all of the chemical compounds in the diet (e.g. starch). For each compound you have listed, describe the fermentation process in the rumen. For each compound identify what % is fermented in the rumen and what % is digested in the intestine
Please - Please have an original assignment not copied because I have to submit to a...
Please - Please have an original assignment not copied because I have to submit to a citing program. The purpose of this assignment is to review the current state of development for your state's health information exchange (HIE) and current participation rate. Compare your state (New Jersey) to three states with similar demographics. Write a 1,000-1,250 word summary related to the ability of your state's HIE to share data and improve the following: Coordination of care Public health initiatives Evidence-based...
Looking for a detailed work breakdown structure for a football stadium. Please do not answer it...
Looking for a detailed work breakdown structure for a football stadium. Please do not answer it with a definition. The more details the better.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT