CLRS icon indicating copy to clipboard operation
CLRS copied to clipboard

Problem 6-2

Open Arthur-Kitsuragi opened this issue 1 year ago • 2 comments

You have written the function d-ARY-CHILD(i, j) in par. a, in par.c you are using d-ARY-CHILD(k, i), which is not correct. It should be d-ARY-CHILD(i, k). Moreover, I find no sense in using two if-clauses : if d-ARY-CHILD(k, i) ≤ A.heap-size and A[d-ARY-CHILD(k, i)] > A[i] ; if A[d-ARY-CHILD(k, i)] > A[largest]. if d-ARY-CHILD(k, i) ≤ A.heap-size and A[d-ARY-CHILD(i,k)] > A[largest] will be enough.

Arthur-Kitsuragi avatar Sep 02 '23 19:09 Arthur-Kitsuragi

I do not know if it is useful, but in par.b i found more accurate expression for height : h = floor(log d (n(d-1) + 1))

Arthur-Kitsuragi avatar Sep 02 '23 19:09 Arthur-Kitsuragi

For (b), I think you're right. Since $\Theta(\log_d n)$ is also correct, I'll leave it as it is for now. For (c), Updated the if-clause in the pseudocode.

Thank you!

walkccc avatar Sep 05 '23 09:09 walkccc