240 views

Please log in or register to answer this question.

Related questions

0 votes
0 votes
0 answers
1
akash.dinkar12 asked Jun 26, 2019
226 views
Why do we want the loop index $i$ in line $2$ of BUILD-MAX-HEAP to decrease from $\lfloor A.length/2 \rfloor$ to 1 rather than increase from 1 to $\lfloor A.length/2 \rfl...
0 votes
0 votes
0 answers
2
akash.dinkar12 asked Jun 26, 2019
531 views
BUILD-MAX-HEAP(A) 1 A.heapsize=A.length 2 for i=A.length/2 downto 1 3 MAX-HEAPIFY(A,i)Using Figure $6.3$ as a model, illustrate the operation of BUILD-MAX-HEAP on the arr...
0 votes
0 votes
0 answers
3
akash.dinkar12 asked Jun 27, 2019
305 views
Give an $O(n\lg\ k)$- time algorithm to merge $k$ sorted lists into one sorted list, where $n$ is the total number of elements in all the input lists. (Hint: Use a minhea...
0 votes
0 votes
1 answer
4
akash.dinkar12 asked Jun 27, 2019
512 views
The operation HEAP-DELETE$(A, i)$ deletes the item in node $i$ from heap $A$. Give an implementation of HEAP-DELETE that runs in $O(lg\ n)$ time for an $n-$element max-h...