Binary Search Trees in Python: Introduction - Insertion and Search

preview_player
Показать описание
In this video, we will go over the binary search tree data structure. We will first cover the general idea of what a binary search tree is and how one may go about inserting data into this structure as well as how one searches for data. Once we cover the general idea, we will move over into the terminal and implement the binary search tree data structure in Python. We will construct two class methods that will implement the search and insertion algorithms.

If you are unfamiliar with tree-like data structures, I would encourage you to watch first the series on binary trees. A binary search tree is a type of binary tree. It is important to understand the various terminology used in the context of a tree data structure (root, node, leaves, parent, child, etc.). If any of those terms are unfamiliar to you, or you would like to brush up on them, the binary tree playlist may be found here:

This video is part of a playlist on binary search trees:

Slides:

The software written in this video is available at:

Do you like the development environment I'm using in this video? It's a customized version of vim that's enhanced for Python development. If you want to see how I set up my vim, I have a series on this here:

If you've found this video helpful and want to stay up-to-date with the latest videos posted on this channel, please subscribe:
Рекомендации по теме
Комментарии
Автор

I'm not the last or the first to say that you're a great teacher. Thanks

raisamaria
Автор

Your explanation was really amazing, you should come back make more of this awesome videos. I was confused all day about how to define the bst functions and magically youtube suggested your channel.

rumanaislam
Автор

Hi! I've taken data structure classes before (in java) and needed a refresher for Trees and in python. Your video series has been fantastic. Theory has been excellent and the code has been clean. Most tutorials I've seen have grouped the Node and BST classes together and I really didn't like that. I'm glad you split them up! Thank you for your amazing contributions.

ahmedkidwai-
Автор

The way u teach in the video is truly impeccable..For me, ur videos are one of the best.., The concepts get clear..

rohanchakraborty
Автор

Thanks man.. you have no idea how much your videos have helped me.

shrikantpande
Автор

I can't believe this channel has only 30k subs. Really amazing content. Thank you for this.

milkiasyeheyis
Автор

OMMMGGGG MY REAL MVP❤️❤️❤️❤️❤️❤️ THANKS A LOT SIR PLS KEEP MAKING VIDEOS LIKE THESE THEY HELP ME LEARN AND SURVIVE IN COLLEGE😭😭😭😭😭😭😭❤️❤️❤️❤️❤️ MUCH LOVE

annidamf
Автор

Oh my god I finally understood how to implement the bst in python, thanks alot! Great video!

muggie_guava
Автор

Your explanation is amazing! Especially for the part which requires a lot of focus, I was able to understand in one go. Thank you, Please keep making content like this.

dhashdev
Автор

It would be really helpful if you can continue this series.

NikhilParekh
Автор

This awesome playlist deserves a video on remove method for BST and finally avl trees and heaps :D

rahls
Автор

I am so glad I found your videos. I watched all the videos in the Data Structures playlist of yours. I referred many books and videos but none of them have such a clear explanation of concepts as yours. Could you please make videos on Graphs as well? :)

mrinmayigavali
Автор

you taught the code in an easy manner....I like you so much sir.

harshavardhanachary
Автор

My takeaway on BST based on your awesome explanation:
1.BST is very good for searching, deletion and insertion provided the tree is balanced(log n).The selection of the root node will determine how balanced the tree will be.AVL or Splay tree will ensure the tree remain balanced.
2.If tree isn't balanced we essentially have a long list, making the time complexity O(n)
3.I noticed that if you apply Inorder traversal to a BST you get the nodes in ascending order.So if we want to sort with a tree it will O(nlogn) because building the tree is O(n)

khavishbhundoo
Автор

Thanks a lot for making these videos. Python will be even easier to learn with such a great teacher!

marinboras
Автор

I was stuck with trees at some other course, but your code and explanations are very intuitive and make a lot of sense. Subscribed and thanks!

peregudovoleg
Автор

Thank you for such a nice and clear presentation,

bijayamanandhar
Автор

This is one of the best explained videos on Trees! Good job and thanks for the lucid explanation :) If I were to print the tree output as an image, how could I do that?

IshuGoelIshIshIsh
Автор

Incredible! Absolutely incredible! Thank you so much for your content! This is golden content!

JoseHernandez-edlz
Автор

Please make a video on hashing and hash table stuffs...

rohanchakraborty