This question is similar to this. The difference is that I have a binary Max-Heap instead of a Min-Heap. Which makes the question totally different.
My thoughts:
1) I go through all the nodes to find the second smallest element, this will take O(n)
2) When I find the 2nd smallest element, I bubble that element up, by swapping it with its parent until it reaches the root, this will take O(logn)
3) I remove the element from the root and take the right-most element and store it at root location (regular heap delete operation), this will take O(logn)
Total will be O(n) + O(logn) + O(logn), which is O(n).
Edited: Added binary
Is there a better solution than that?