search
Log In
0 votes
27 views

The code for MAX-HEAPIFY is quite efficient in terms of constant factors, except possibly for the recursive call in line 10, which might cause some compilers to produce inefficient code. Write an efficient MAX-HEAPIFY that uses an iterative control construct (a loop) instead of recursion.

in Algorithms 27 views

Please log in or register to answer this question.

Related questions

0 votes
0 answers
1
20 views
Show that the worst-case running time of MAX-HEAPIFY on a heap of size $n$ is $\Omega(lg\ n)$.(Hint: For a heap with $n$ nodes, give node values that cause MAXHEAPIFY to be called recursively at every node on a simple path from the root down to a leaf).
asked Jun 26, 2019 in Algorithms akash.dinkar12 20 views
0 votes
0 answers
2
0 votes
0 answers
3
19 views
What is the effect of calling MAX-HEAPIFY$(A, i)$ when the element $A[i]$ is larger than its children?
asked Jun 26, 2019 in Algorithms akash.dinkar12 19 views
0 votes
0 answers
4
39 views
Starting with the procedure MAX-HEAPIFY, write pseudocode for the procedure MIN-HEAPIFY$(A, i )$, which performs the corresponding manipulation on a minheap. How does the running time of MIN-HEAPIFY compare to that of MAXHEAPIFY?
asked Jun 26, 2019 in Algorithms akash.dinkar12 39 views
...