Comments (1)
@vikkastiwari I hope my explanation reaches your expectation
So, According to your question we have to delete the node marked as Child1
.
So after iterating we find that temp
pointer is pointing to the child1
and the parent
pointer is pointing to the root
node. hope you understand how...
Now, according to your tree structure, temp->left
is null so this means left side of child1
is null or empty so if I could make the parent
node point to the left side of child1
then we can bypass the child1
hence removing it from the tree
hence we have parent->left = temp->left
saying that parent left side will be now null and hence making child1
unreachable.
and to free the memory we use free(temp);
Hope, this helps
from data-structures-and-algorithms.
Related Issues (5)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from data-structures-and-algorithms.