Breadth First Search Algorithm

แชร์
ฝัง
  • เผยแพร่เมื่อ 16 ก.พ. 2013
  • This is one of the important Graph traversal technique. BFS is based on Queue data structure.
    Analysis:
    The time complexity of BFS using Adjacency list is O(V + E) where V & E are the vertices and edges of the graph respectively.
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 304

  • @tjfirhfjejUTH24
    @tjfirhfjejUTH24 9 ปีที่แล้ว +526

    great video. accent didn't phase me at all stop complaining people this is free information! be thankful

    • @holhorse3808
      @holhorse3808 5 ปีที่แล้ว +2

      *WELCOME TO BURGER KING*

    • @MohitSharma-xf9wp
      @MohitSharma-xf9wp 4 ปีที่แล้ว +1

      even your accent is also damm horrible

  • @NippyWolf
    @NippyWolf 8 ปีที่แล้ว +60

    I have seen alot of videos about this subject, but you video is by far the most simple and most clear explanation. Also liked your DFS video. Thank you!

  • @ammarseud5461
    @ammarseud5461 5 ปีที่แล้ว +36

    Watched on x2 speed with no sound, understood everything. The video is just that good :)

  • @gogateiit
    @gogateiit  11 ปีที่แล้ว +40

    Thanks Anny :) Please share "Breakfast Search" with your friends and keep watching.

    • @brendamoragwa2474
      @brendamoragwa2474 3 ปีที่แล้ว +2

      I learnt a lot in this video. Thank you so much❤

  • @himanshukashyap6336
    @himanshukashyap6336 7 ปีที่แล้ว +46

    I LITERALLY GOT SCARED WHEN HE SAID, "THAT'S IT, DONE!". ANYWAYS, IT WAS REALLY HELPFUL, SIMPLE LANGUAGE, EASY TO UNDERSTAND.

  • @liveLifeHappyFull
    @liveLifeHappyFull 4 ปีที่แล้ว

    The best video so far. Everytime I get confused between DFS and BFS I always come here!! Thank you so much

  • @akhilballa6838
    @akhilballa6838 9 ปีที่แล้ว +93

    how can someone dislike this? its ample explanation for this topic .

    • @vanreus6150
      @vanreus6150 4 ปีที่แล้ว +9

      Because of the Indian accent

    • @EzioOmer
      @EzioOmer 3 ปีที่แล้ว

      @@vanreus6150 surhay sen misin aw sadAS:ada

    • @vanreus6150
      @vanreus6150 3 ปีที่แล้ว

      evet lanhsbsbsa

    • @EzioOmer
      @EzioOmer 3 ปีที่แล้ว

      @@vanreus6150 sdakjdasjklaskdjas olm path finding bir araştırayım dedim :ASDasads sen çıktın olaya bak

  • @djjonno91
    @djjonno91 10 ปีที่แล้ว +1007

    breakfast search

    • @RedSlim007
      @RedSlim007 9 ปีที่แล้ว +7

      lol

    • @ArvindhMani
      @ArvindhMani 8 ปีที่แล้ว +8

      +Jonathon Scanes Gotta say, from an Indian point of view, I've heard FAR FAR worse.

    • @SuBiBH
      @SuBiBH 7 ปีที่แล้ว

      yes please!

    • @NwNCq
      @NwNCq 7 ปีที่แล้ว +1

      Thank you! Now I can't think otherwise..

    • @sleeksilve2
      @sleeksilve2 7 ปีที่แล้ว +2

      ...every morning when I wake up... sometimes noon.

  • @aditinarware9843
    @aditinarware9843 7 ปีที่แล้ว +2

    Very well explained, both DFS and BFS. Simple and clear!

  • @deejay5627
    @deejay5627 8 ปีที่แล้ว +7

    Thank you so much! This and your Depth-first search video have been very helpful and easy to understand. In fact I'd prefer these over my school notes!

  • @shashwatkansal6786
    @shashwatkansal6786 4 ปีที่แล้ว

    Very clear, very simple, couldn't have had a better explanation. Thanks a lot!

  • @Monyamu
    @Monyamu 4 ปีที่แล้ว +2

    Great video, helped me a lot in visualizing the progress of the algorithm. I learned it a tiny differently however, regarding the first step, i don't know if its a mistake here, or not.
    A is added to the queue before the loop, (the video starts from here--->)marked as visited, added to the output sequence.
    We take A as currently working node (this is the time, when it's removed from the queue, not shown here in the video), then take it's unvisited neighbours, everything else goes as in the video.
    If you learned it like this, that might be those declarations before the double loop in the structogram.

  • @krlwshu
    @krlwshu ปีที่แล้ว

    I wasted 2 hrs in a lecture trying to make sense of what you explained perfectly in 4 minutes. Thank you.

  • @jackchun8767
    @jackchun8767 7 ปีที่แล้ว

    Clean and clear explanation, Thank you so much ! Looking forward to see more of your tutorial video :)

  • @AdamGreenhill
    @AdamGreenhill 10 ปีที่แล้ว +10

    Thanks man! This + DFS helped!

  • @azzarox6661
    @azzarox6661 8 ปีที่แล้ว

    Thanks for the refresher, needed to implement this for an assignment and couldn't remember how. This really helped!

  • @viduraweerasinghe6624
    @viduraweerasinghe6624 9 ปีที่แล้ว +8

    Thank you very much ,,, very clear explanation !!!

  • @ParameswaraReddyBanthikatla
    @ParameswaraReddyBanthikatla 4 ปีที่แล้ว

    Best simplest possible explanation. Thank you

  • @yanivgardi9028
    @yanivgardi9028 8 ปีที่แล้ว +3

    thanks. it's a good video, but i think it's worth mentioning that when running a BFS starting from vertex A, you actually create a Tree structure (sub-set of the edges), with a root A, that connects all vertexes in the graph to vertex A with the shortest path

  • @iamusmanshabbir142
    @iamusmanshabbir142 2 ปีที่แล้ว

    Best simple easy graphical representation i'was looking for

  • @AkhilKumar
    @AkhilKumar 10 ปีที่แล้ว +14

    Useful..need more videos please....great channel :-D thanks!

  • @madhupnetfundu
    @madhupnetfundu 11 ปีที่แล้ว +1

    This is a great video, thank you for uploading !!

  • @emannawaz6647
    @emannawaz6647 ปีที่แล้ว

    today is my paper of data structure and you clr my all confusion of BFS and DFS...........thnx a lot sir g

  • @Mr1Samurai1
    @Mr1Samurai1 9 ปีที่แล้ว +2

    Very clear explanation, thank you.

  • @iamnero9
    @iamnero9 8 ปีที่แล้ว

    Thank you very much! It made a great help for me to understand this one in simpler way.

  • @DJBuckCallYo
    @DJBuckCallYo 7 ปีที่แล้ว

    Simple and clear explanation, thank you!

  • @samanthatitewebber7472
    @samanthatitewebber7472 9 ปีที่แล้ว

    Great explanation and illustration, thank you.

  • @LikeACrouton
    @LikeACrouton 9 ปีที่แล้ว +2

    Thanks a lot, very clear explanation.

  • @teeman9266
    @teeman9266 9 ปีที่แล้ว

    Great vid, simple and on point!

  • @sliq101
    @sliq101 4 ปีที่แล้ว +1

    great video , short and very precise

  • @Annyv2
    @Annyv2 11 ปีที่แล้ว +3

    I loved this video, it also made me laugh, I kept hearing "breakfast search" wich made it even more memorable

  • @luc1179
    @luc1179 7 ปีที่แล้ว

    Absolutely crystal clear!

  • @rahulmarkonda
    @rahulmarkonda 5 ปีที่แล้ว

    Simple yet Superb explanation. Thank you.

  • @Zinic_
    @Zinic_ 8 ปีที่แล้ว +30

    Another way to look at it: Start with A. One step away from A is B and S. Two steps away from A is C and G. Three steps away from A is D E F H.

    • @almind2894
      @almind2894 7 ปีที่แล้ว +1

      thanks!

    • @majdayoub2344
      @majdayoub2344 6 ปีที่แล้ว

      But what are the complexities of both ways?

    • @SCShield
      @SCShield 6 ปีที่แล้ว

      Breadth-first search and depth-first search are both linear algorithms.

  • @rafvandenbosch5808
    @rafvandenbosch5808 4 ปีที่แล้ว

    concise and good explanation. Thanks !

  • @YocasFilmz
    @YocasFilmz 10 ปีที่แล้ว

    Thanks for the explanation!

  • @FranciscoCostaRamos
    @FranciscoCostaRamos 9 ปีที่แล้ว +2

    Hey, can you add the d and pi values for each vertice? thanks

  • @irenek7291
    @irenek7291 5 ปีที่แล้ว

    This really helped, thankyou!!

  • @NikoNikomedes
    @NikoNikomedes 6 ปีที่แล้ว

    Very clear and understandable example, thank you very much

  • @jcx5750
    @jcx5750 8 ปีที่แล้ว

    This was very helpful. Thank you.

  • @austyncousins4978
    @austyncousins4978 5 ปีที่แล้ว

    Excellent explanation - thanks!

  • @lokeshbajracharya5190
    @lokeshbajracharya5190 7 ปีที่แล้ว

    AWESOME, you put it so simple.. thanks

  • @balamajay834
    @balamajay834 6 ปีที่แล้ว +1

    This video is very clear and very easy to understand

  • @JessicaMary0702
    @JessicaMary0702 4 ปีที่แล้ว +4

    This is so helpful to review for final exams. 😄

  • @yosef5953
    @yosef5953 5 ปีที่แล้ว

    Wow explained very well. Thank you so much.

  • @monikasinha379
    @monikasinha379 10 ปีที่แล้ว

    Thank u so much sir.....
    is there video for algorithm of this ???

  • @Zebban89
    @Zebban89 9 ปีที่แล้ว +2

    many thanks for this video! :)

  • @faizmohammadfaqiry5403
    @faizmohammadfaqiry5403 8 ปีที่แล้ว

    very nice demonstration sir, Thank you ,
    it helped me.

  • @ivanivanov2160
    @ivanivanov2160 10 ปีที่แล้ว

    Very well explained ! Cheers !

  • @cryptoanalyst5058
    @cryptoanalyst5058 7 ปีที่แล้ว

    Very well explained. Thank you

  • @vickylance
    @vickylance 10 ปีที่แล้ว +17

    I am clearly understanding the algorithm but not able to write a program and also not able to understand the program already writtern by someone else ..... I definitely need a video which explains the algorithm with the help of a program.

    • @gustavoturm
      @gustavoturm 9 ปีที่แล้ว

      Take a look at Dieter Jungnickel's "Graphs, Networks and Algorithms" and also at Sedgewick's "Algorithms".

    • @vickylance
      @vickylance 7 ปีที่แล้ว

      Gustavo Bandeira
      Now I am more into developing Hololens Applications. :)

  • @gaboonviper89
    @gaboonviper89 9 ปีที่แล้ว

    Great explanation, thank you uploading this.

  • @justincaseOne
    @justincaseOne 2 ปีที่แล้ว

    thanks for the effort!

  • @cs-27
    @cs-27 8 ปีที่แล้ว

    Thanks a lot!!!!!!!! it's fabulous!!!!!!!!!! It'll be a great help before exams to go through these...........

  • @funbox5292
    @funbox5292 6 ปีที่แล้ว

    Very Informative :) Great work,.. keep it up :)

  • @johnmassaad7904
    @johnmassaad7904 9 ปีที่แล้ว +1

    Very helpful, Thank you very much:)

  • @huzzakawah
    @huzzakawah 10 ปีที่แล้ว

    Thank you for the video. Very helpful.

  • @anayaz2934
    @anayaz2934 6 ปีที่แล้ว

    your material is very information . i have some questions related to your topic can u plzzz tell me Why BFS take a lot of space than DFS, although their space complexity is same? and why we implement BFS by only using queue?

  • @shaw6781
    @shaw6781 9 ปีที่แล้ว

    awesome explanation man...thz a lot for the upload....

  • @openworld7585
    @openworld7585 3 ปีที่แล้ว

    Thank you for such good video

  • @karolinekkk
    @karolinekkk 4 ปีที่แล้ว

    Great explanation! to the point!

  • @samuelgosselin5150
    @samuelgosselin5150 6 ปีที่แล้ว

    great video thanks for the short length

  • @CamKnoppMusic
    @CamKnoppMusic 4 ปีที่แล้ว

    Great vid. Nice and simple.

  • @badwaikrohit
    @badwaikrohit 9 ปีที่แล้ว +3

    Nice explanation! But if you could add little about the algo's complexity and explain it, then it could have made this very useful.

  • @craumm
    @craumm 6 ปีที่แล้ว

    When you are S, you check A as well, and since it is visited, it is not added on the Queue. You discussed this with E, F and H. Nice video

  • @supernalmalang749
    @supernalmalang749 7 ปีที่แล้ว

    i can understand it very well..... thank you so much

  • @def__init
    @def__init 5 ปีที่แล้ว

    POP IT OFF I love it thank you

  • @sindhuchinniah4363
    @sindhuchinniah4363 6 ปีที่แล้ว

    Thank you so much. It was helpful.

  • @MrPali1
    @MrPali1 7 ปีที่แล้ว

    helpful, but it would be nice to know the path, say, if H was the end node, how do you find the shortest path?

  • @mindormood1
    @mindormood1 9 ปีที่แล้ว +1

    thanks man, you are awesome!!!!!!

  • @kautukraj
    @kautukraj 3 ปีที่แล้ว +1

    Very helpful, thank you.

  • @mheepooh7413
    @mheepooh7413 5 ปีที่แล้ว

    very clear explanation.
    thanks sir

  • @anandkalyanji
    @anandkalyanji 11 วันที่ผ่านมา

    Thanks , the video is helpful even after a decade as watching it in 2024

  • @dharinibaswal2987
    @dharinibaswal2987 10 ปีที่แล้ว +1

    thanks a lot:)
    pls do a vid on topological sort also..

  • @sashanknarisipalli
    @sashanknarisipalli 10 หลายเดือนก่อน +2

    Wow !! It's really been 10 years and i am watching it now😅

  • @dennistsai5348
    @dennistsai5348 8 ปีที่แล้ว

    it's awesome!
    thanks a lots

  • @simrannadaf6018
    @simrannadaf6018 4 ปีที่แล้ว

    Tysm 4explaining within short span of time 😊😊

  • @shashikumarlamsal6968
    @shashikumarlamsal6968 7 ปีที่แล้ว

    short but sweet...nice explanation

  • @bhupeshpant8830
    @bhupeshpant8830 10 ปีที่แล้ว

    very helpful and easy as compared to any other technique for BFS.

  • @shyamasishgupta5206
    @shyamasishgupta5206 7 ปีที่แล้ว

    Thanks For the video. But i have a doubt. If the empty queue is the ending condition for the algorithm, then after Dqueue of 'S', the queue was empty. Why the algorithm didn't stop in that time itself?

  • @TaraArya92
    @TaraArya92 8 ปีที่แล้ว

    Nice Explanation, Thanks you so much....

  • @Dylan-ig9pg
    @Dylan-ig9pg 8 ปีที่แล้ว +32

    Before my exam on Friday, I'm going to think "GO-GATE-IIT".

    • @Leon-pn6rb
      @Leon-pn6rb 7 ปีที่แล้ว +6

      haha actually GATE and IIT are national level test and college resp. in india
      The pun is sad

    • @anjalidinesh7767
      @anjalidinesh7767 7 ปีที่แล้ว +5

      Agreed, the pun is ridiculous xD

  • @corecse_AI
    @corecse_AI 2 ปีที่แล้ว

    Is it compulsory to visiting adjacent nodes in lexical order?

  • @user-pp4jd5ql9j
    @user-pp4jd5ql9j 10 ปีที่แล้ว +1

    Kind sir thank you.

  • @sarvodaykumar2723
    @sarvodaykumar2723 4 ปีที่แล้ว

    Hello dear teacher could you please add video code on adding and delete new node/ edge in graph

  • @Arfiry
    @Arfiry 6 ปีที่แล้ว

    is it only use for graph traversals, or also directed graph ?

  • @GrundGad
    @GrundGad 10 ปีที่แล้ว

    s.o.b !!! I finally understand it !!!!!!!!!! thank you!

  • @kautukraj
    @kautukraj 3 ปีที่แล้ว +1

    Very helpful!

  • @rockngelement
    @rockngelement 10 ปีที่แล้ว

    hey an awesome awesome awesome video :) :) thanks alot for your DFS and BFS algos. you've explained it well :) :) i wish you were the professor of my college :D.

  • @pavarayaa
    @pavarayaa 5 ปีที่แล้ว +1

    In Breadth First Search (BFS) Algorithm, the search should start from the root node which is in level 0, isn't it? And then goes level by level from left to right.

  • @GRV1198
    @GRV1198 11 ปีที่แล้ว

    perfectly explained, thx

  • @Farahat1234
    @Farahat1234 5 ปีที่แล้ว

    It was really helpfull vdo for me😊 thanks a lott

  • @mrafieis
    @mrafieis 10 ปีที่แล้ว

    concise and good. thanks.

  • @jyotithasal1261
    @jyotithasal1261 8 ปีที่แล้ว

    thank u so much...its very helpful for me

  • @folksgames7047
    @folksgames7047 8 ปีที่แล้ว

    Thank you!

  • @sendittoramesh
    @sendittoramesh 10 ปีที่แล้ว +2

    thank you

  • @utube7100
    @utube7100 11 ปีที่แล้ว +1

    Keep up the good work... :)

  • @jyotilohan7154
    @jyotilohan7154 6 ปีที่แล้ว

    Nice yrr.. This is very useful for me.... Thanku sir

  • @lowochi
    @lowochi 5 ปีที่แล้ว

    How would it look if you used a stack?

  • @amalsathyan5530
    @amalsathyan5530 3 ปีที่แล้ว

    Thanks really helped ❤️