Interviewer And Interviewee Guide

Data Structures Trees Interview Question:

Can you explain implementation of deletion from a binary tree?

Submitted by: Administrator
To implement the deletion from a binary tree, there is a need to consider the possibilities of deleting the nodes. They are:

- Node is a terminal node: In case the node is the left child node of its parent, then the left pointer of its parent is set to NULL. In all other cases, if the node is right child node of its parent, then the right pointer of its parent is set to NULL.

- Node has only one child: In this scenario, the appropriate pointer of its parent is set to child node.

- Node has two children: The predecessor is replaced by the node value, and then the predecessor of the node is deleted.
Submitted by: Administrator

Read Online Data Structures Trees Job Interview Questions And Answers
Copyright 2007-2024 by Interview Questions Answers .ORG All Rights Reserved.
https://InterviewQuestionsAnswers.ORG.