data structures - Deleting a node in a binary tree having children -


if have delete node binary tree, how should handle children of node being deleted. e.g. in tree:

    100    /   10   /  \ 5    20  

where 100 root node, 10 left child of 100, 5 left child of 10 , 20 right child of 10. after deleting 10, happen 5 , 20?

it choice if should after deleting.you want move 1 of child upward on criteria. either of of child take place of parent.

  1. delete node in binary search tree.
  2. delete node in avl.
  3. heapify in heapsort.
  4. and more.

so choice have take solve objective.


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -