How to delete a node with 2 children nodes in a binary tree?
Is there any kind of method to remove it? I googled it. But didn’t get clear idea about it. Anybody explain it with diagrammatic representation?
How to delete the node ‘5’ from the this image and what might be the outcome?
you replace said node with the left most child on its right side, or the right most child on its left side. You then delete the child from the bottom that it was replaced with.
Deleting five could yield either a tree with 3 as its root or 18 as its root, depending on which direction you take.
It looks like you got that image from this site: http://www.algolist.net/Data_structures/Binary_search_tree/Removal
It shows the algorithm you want with images too.