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.
Binary tree is a special case of a general tree where you can have maximum 2 children for any given node. They are useful in implementing set/map class in different programming languages. They provide efficient way of search an element in log n complexity. There are various traversal schemes you can use such as breadth first search and depth first search. In depth first search you can use in order traversal, pre order traversal and post order traversal schemes that will benefit in different scenarious. For example in order traversal gives you a sorted list of elements in a tree. After going through theory we will implement binary tree, rather binary search tree in python. Binary search tree is also known as BST that is basically a binary tree with some order of elements.
Code: https://github.com/codebasics/data-structures-algorithms-python/blob/master/data_structures/8_Binary_Tree_1/binary_tree_part_1.py
Exercise: https://github.com/codebasics/data-structures-algorithms-python/blob/master/data_structures/8_Binary_Tree_1/8_binary_tree_part_1_exercise.md
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.