Back to course home
0% completed
Vote For New Content
Incorrect implementation of Iterative Approach
senthil kumar
Mar 29, 2024
n a binary min heap, every node must be smaller than or equal to its children. The iterative approach only checks and maintains this property for the inserted node and its parent, but it doesn't check the sibling of the inserted node. This could lead to a situation where a node is smaller than one child but larger than the other.
So, while the iterative approach is a valid start, it's not a complete implementation of a binary min heap. The recurrsion approach is a complete and correct implementation.
1
0
Comments
Comments