Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem 6-2 #484

Open
Arthur-Kitsuragi opened this issue Sep 2, 2023 · 2 comments
Open

Problem 6-2 #484

Arthur-Kitsuragi opened this issue Sep 2, 2023 · 2 comments

Comments

@Arthur-Kitsuragi
Copy link

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
Copy link
Author

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 Arthur-Kitsuragi changed the title Problem 6-2 (c) Problem 6-2 Sep 2, 2023
@walkccc
Copy link
Owner

walkccc commented Sep 5, 2023

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants