I searched and didn’t find a way to do this, if it exists, can you guys help me how to do it?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Depending on your exact heap layout, you probably have two candidates (assuming that your root is the min element and the second layer are the max elements).
Choose the max one, and replace it with the last element of the heap – as with a regular heap – and perform a downward heap repair. Just as with a regular heap, starting at position 1 or 2 instead of 0, and going down to levels as you do in a min-max-heap.