Recent questions tagged cormen

0 votes
0 answers
62
Why do we bother setting the key of the inserted node to $-\infty$ in line $2$ of MAX-HEAP-INSERT when the next thing we do is increase its key to the desired value?
1 votes
0 answers
63
Write pseudo code for the procedures HEAP-MINIMUM, HEAP-EXTRACT-MIN, HEAP-DECREASE-KEY, and MIN-HEAP-INSERT that implement a min-priority queue with a min-heap.
0 votes
0 answers
66
0 votes
0 answers
68
0 votes
0 answers
71
0 votes
0 answers
72
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 answers
73
0 votes
0 answers
77
0 votes
0 answers
81
0 votes
0 answers
82
What is the relationship between the running time of insertion sort and the number of inversions in the input array? Justify your answer.
0 votes
1 answer
83
0 votes
1 answer
86
0 votes
0 answers
90