Ask your own question, for FREE!
Computer Science 20 Online
OpenStudy (anonymous):

how to write a code for delet operation in avl tree in c

OpenStudy (nethwa):

Assuming that you mean a delete operation - thats not far away from a delete operation of a normal tree. Just delete the node, if the node has only one son then let this son be the new son of the father of the deleted node. If there are two or more sons you need an algorithm that chooses the rightest of the left subtree or the leftest of the right subtree - depends on the balance factor. After this rebalance the tree. Alternatively you could just remove the node and add the subnodes of the deleted node again, but this wouldn't be O(1) or O(log n) anymore - but it would work.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!