Back to Browse

Data Structures: Delete a node from N-ary tree | C++ Tutorial

2.2K views
Aug 10, 2022
13:37

In this data structures video you will learn how to delete a node from an n-ary tree using C++. This is a tree in which each node can have more than 2 children. There are four unique cases, the node to be deleted either; 1) Is a leaf node, 2) Has one child, 3) Has many children and you want to promote all of the children. 4) Has many children and you want to promote only one of the children. You will also learn how to use recursion to search for a node in an n-ary tree using Depth First Search (DFS). Previous topics covered included deleting a node from a binary tree or binary search tree. This topic is slightly more advanced and is not asked on LeetCode. However, it is relevant to real world projects. Resources: ~~MyCodeSchool: Deleting a node from a binary search tree: https://www.youtube.com/watch?v=gcULXE7ViZw ~~Creating an n-ary tree: https://www.youtube.com/watch?v=bADJ2IjFsWs ~~The code for printing a tree in 2D to the screen was taken from: https://www.geeksforgeeks.org/print-n-ary-tree-graphically/ Thanks for watching! ~~My Udemy Courses on Motion Planning / Navigation / Trajectory Planning: https://www.udemy.com/course/autonomous-robots-nonholonomic-motion-planning-algorithms/ ~~Website: https://www.vinayakd.com/ ~~Instagram: https://www.instagram.com/vinayak_desh/

Download

1 formats

Video Formats

360pmp418.7 MB

Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.

Data Structures: Delete a node from N-ary tree | C++ Tutorial | NatokHD