How to Construct a Binary Search Tree

Поделиться
HTML-код
  • Опубликовано: 18 ноя 2024

Комментарии • 88

  • @2002egncn
    @2002egncn 2 года назад +12

    Very well explained. I really had hard time understanding BST before this video!

  • @jesseliverless9811
    @jesseliverless9811 2 года назад +88

    Hello to students from The Odin Project

    • @nuru484
      @nuru484 9 месяцев назад +4

      Hi there, a student from Odin

    • @hongquannguyen5532
      @hongquannguyen5532 7 месяцев назад +5

      wow, not many students left huh

    • @shillo9262
      @shillo9262 6 месяцев назад +1

      heyyy

    • @Liam-c5k
      @Liam-c5k 6 месяцев назад +2

      Hey ;)

    • @ThatCodeKid
      @ThatCodeKid 5 месяцев назад +1

      Hello fellow odin

  • @darkkupo5162
    @darkkupo5162 4 года назад +44

    I always thought binary search trees had to be balanced and that was giving me a hard time. I know now that having an ugly tree is perfectly fine

    • @yosuanicolaus
      @yosuanicolaus 2 года назад +3

      same!

    • @sankofax8082
      @sankofax8082 Год назад

      you still need a balanced tree if you want to run faster search, insert, etc operations.

  • @racecar7808
    @racecar7808 4 года назад +1

    #1 explanation about BST in U-tube. 100% 👍👍👍

  • @dhruvsahu726
    @dhruvsahu726 6 лет назад +15

    Awsome sir i got full marks in my examination at this question.

    • @edutechional
      @edutechional  6 лет назад +3

      I'm glad that you found it helpful!

  • @vaishnavihegde6949
    @vaishnavihegde6949 3 года назад +5

    Thank you so much for helping me understand the concept !!

  • @dylanhughes5944
    @dylanhughes5944 7 лет назад +22

    Thanks man, you saved me! :D

  • @anch1994
    @anch1994 2 года назад +3

    why did 8 'split' the 9 node? every other number went down the tree to the last entry and then to the left or right of it but 8 went to 9, skipped 14 and went to the left of 9. Why is that?

    • @porobertdev
      @porobertdev 4 месяца назад

      As far as I understand, the value to be added is compared with each node, starting from the root, and it must reach a leaf node (node without any child nodes) that it'll get added to.
      The traversal of the whole tree seems to work like this:
      Compare node with first node (root)
      If smaller, then "move" in the left.
      Otherwise, move to the right.
      Repeat for each node until a leaf node is reached.

  • @qiongyun
    @qiongyun 6 лет назад +1

    This video saved me . It's really helpful.

    • @edutechional
      @edutechional  6 лет назад

      I'm glad that you found it helpful!

  • @blublackbluberry
    @blublackbluberry 7 лет назад +2

    What if we want to search 7? is the last 7 after 8 will be searched or when it search the first 7 and the search end?

  • @vinci_irl
    @vinci_irl 6 лет назад +1

    About 7 - your argument is that it goes right, because it's NOT LESS then 7, i can got with the same argument and say it can't got left because it's NOT GREATER then 7.
    It should just remain the way it was, without adding extra 7 into the tree.

    • @wonjaehwang7670
      @wonjaehwang7670 6 лет назад +3

      Actually if a number is equal or greater, it goes right

  • @RakeshHRakeshH-x1b
    @RakeshHRakeshH-x1b 11 месяцев назад

    thank you .
    so much "Understanding"

  • @RR-et6zp
    @RR-et6zp 2 года назад

    Great explanation !!

  • @EL_WAFI_CHERKAOUI
    @EL_WAFI_CHERKAOUI Месяц назад

    this is why binary search is only effectively working on already sorted arrays

  • @MinecraftN3rd
    @MinecraftN3rd 6 лет назад +1

    Can you draw BST's in a different order but it still follows the rule of a BST? like can there be 2 versions

  • @andrewyurick4453
    @andrewyurick4453 4 года назад

    Excellent explanations

  • @KrishnadevR-j7b
    @KrishnadevR-j7b Месяц назад +1

    From TheOdinProject .

  • @aldoportillo6743
    @aldoportillo6743 2 года назад +1

    Might be out of the scope of the video but what would happen if you search for 7. Would it return the 7 on the first node or the 7 on the last node or both?

    • @damienspectre4231
      @damienspectre4231 2 года назад +7

      its an old video but he's made a mistake with 7. Binary search trees have these properties:
      1) you cannot have duplicates
      2) Can have at most two children
      -> Consequently the placement of '7' is wrong. It should have been ignored when placing the second time because its already accounted for

  • @madugulasaikumar8800
    @madugulasaikumar8800 3 года назад +1

    Superb sir..❤️

  • @shyamkachhadiya4964
    @shyamkachhadiya4964 6 лет назад

    thanks man you saved the day

    • @edutechional
      @edutechional  6 лет назад

      I'm glad that you found it helpful!

  • @hirankosala123
    @hirankosala123 4 года назад

    You’re directly going to heaven😌💫

  • @soniasargolzaei5424
    @soniasargolzaei5424 9 лет назад +1

    what is the order of building BST from an array?or for example,building BST from 3 sorted arrays?

    • @arshad887
      @arshad887 7 лет назад

      my understanding is that it does each array in an arbitrary fashion, so starts at one, finishes, moves on to next

  • @Neillionaire
    @Neillionaire 4 года назад

    Very helpful!

  • @genotagalog7205
    @genotagalog7205 4 года назад

    Well explained

  • @barbarabyrne6653
    @barbarabyrne6653 2 года назад +1

    Is this in order or pre order or post order. I am so confused by the 3. I can print out what happens but not draw those tree up from initial array. Anybody that can help me please do, I have a test on monday ;(

    • @sasana5656
      @sasana5656 2 года назад

      These is just making a BST from a series of numbers. Preorder and inorder and postorder is for when you have the tree, and you want to navigate it. So this video is about creating a binary search tree, which you can navigate later with those three methods.

  • @ThrashDawg
    @ThrashDawg 10 месяцев назад

    nice video

  • @DennisLeeyeet
    @DennisLeeyeet 9 лет назад

    What is the software you are using?

  • @mathsclassesbyomsir5092
    @mathsclassesbyomsir5092 5 месяцев назад

    Hare Krishna hare Krishna Krishna Krishna hare hare
    Hare ram hare ram ram ram hare hare

  • @brandm5176
    @brandm5176 4 года назад

    Thanks man saved!

    • @edutechional
      @edutechional  4 года назад

      I'm glad that you found it helpful!

  • @fadezzgameplay7077
    @fadezzgameplay7077 5 лет назад +1

    can we put 7 in left side of 7

    • @jamezjaz
      @jamezjaz 4 года назад

      No, I think because 7 isn't less than 7

  • @TheFastTruth
    @TheFastTruth 2 года назад

    Thank u sir..

  • @Aranta4Life
    @Aranta4Life 8 лет назад +1

    are duplicates allowed in a BST? (7)

  • @anthonywanjiru2950
    @anthonywanjiru2950 6 лет назад

    why repeat 7??? what if you are asked to delete 7 from this binary tree you have formed

  • @ViddeshG
    @ViddeshG 8 лет назад

    Thank you so much..this helped!

  • @alterblack6665
    @alterblack6665 5 лет назад

    Thank you very much

  • @sdev_vp
    @sdev_vp 6 лет назад +1

    Thank you! :)

  • @Sky-zg8lz
    @Sky-zg8lz 3 года назад

    Thanks

  • @darshanzare8730
    @darshanzare8730 5 лет назад

    I need graphics project code on this...

  • @6647-v3p
    @6647-v3p 6 лет назад

    Thanks !

  • @rananasser2415
    @rananasser2415 4 года назад +1

    Thank you

  • @CholoRafael
    @CholoRafael 6 лет назад

    thank u man

  • @predkozkaodreta8601
    @predkozkaodreta8601 9 лет назад

    predkozka ready ako nikdy predtym

  • @obriezkaobriezka2441
    @obriezkaobriezka2441 9 лет назад

    moja obriezka je ready

  • @crazwade
    @crazwade 8 лет назад

    thx help alots

  • @branislavpetrzalka5833
    @branislavpetrzalka5833 9 лет назад

    brano sup sem sup tam caka na komentare

  • @predkozkaodreta8601
    @predkozkaodreta8601 9 лет назад

    ready sme

  • @DinosaurSuccess
    @DinosaurSuccess Год назад

    bzzzt

  • @12bucukfalandim
    @12bucukfalandim 5 лет назад

    helal

  • @toontown633
    @toontown633 5 лет назад

    you are beautiful

  • @TheUnown4
    @TheUnown4 3 года назад

    this is terrible and may as well be a linked list