0% Completed
I have 17 years of experience in Programming and Data Science working for big tech companies like NVIDIA and Bloomberg. I also run a famous YouTube channel called Codebasics where I pursue my passion for teaching. Codebasics is one of the top channels on YouTube when it comes to data science, machine learning, data structures, etc. I firmly believe that “Anyone can code” and I use analogies, simple explanations, and step-by-step storytelling to explain difficult concepts in such a way that even a high school student can understand them easily.
In this part 2 tutorial of binary tree, binary search tree (a.k.a BST), we will see how you can delete a node from a binary search tree. We will look at 3 different cases where a node you are deleting is a leaf node, or it has only one child or it has two children. We can handle deletion in different ways in these cases. We will implement node deletion in python and in the end there will be an exercise that you can practice your skills on.
Exercise: https://github.com/codebasics/data-structures-algorithms-python/blob/master/data_structures/9_Binary_Tree_2/9_binary_tree_part_2_exercise.md
Code: https://github.com/codebasics/data-structures-algorithms-python/blob/master/data_structures/9_Binary_Tree_2/binary_tree_part_2.py
New here? Create an account
By logging in, you agree to our Terms and Conditions and Privacy Policy.
Already have an account? Sign in
By continuing, you are agreeing to Codebasics' Terms and Conditions and Privacy Policy.
Please enter the OTP sent to your email ID.