Giter VIP home page Giter VIP logo

Comments (1)

shree1999 avatar shree1999 commented on June 28, 2024 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 photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.