We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Your method for deletion is not completely correct althought it can pass all the test cases. After you swap the last element with the element to be deleted, you should check if the new element is larger than the parent, if not, a swim operation is needed instead of the sink.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
QHEAP1
You are viewing a single comment's thread. Return to all comments →
Your method for deletion is not completely correct althought it can pass all the test cases. After you swap the last element with the element to be deleted, you should check if the new element is larger than the parent, if not, a swim operation is needed instead of the sink.