Breadth First Search Algorithm

แชร์
ฝัง
  • เผยแพร่เมื่อ 27 ม.ค. 2025

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

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

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

    • @holhorse3080
      @holhorse3080 6 ปีที่แล้ว +3

      *WELCOME TO BURGER KING*

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

      even your accent is also damm horrible

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

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

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

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

  • @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 ปีที่แล้ว +40

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

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

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

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

    breakfast search

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

      lol

    • @EdForceOne-p1z
      @EdForceOne-p1z 9 ปีที่แล้ว +8

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

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

      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.

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

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

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

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

    • @vanreus6150
      @vanreus6150 5 ปีที่แล้ว +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

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

    I missed two classes of BFS and this 4:33 sec tutorial covered it up for me. Thank you!

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

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

  • @krlwshu
    @krlwshu 2 ปีที่แล้ว +1

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

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

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

  • @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 8 ปีที่แล้ว +1

      thanks!

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

      But what are the complexities of both ways?

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

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

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

    Best simple easy graphical representation i'was looking for

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

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

  • @deejay5627
    @deejay5627 9 ปีที่แล้ว +6

    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!

  • @anandkalyanji
    @anandkalyanji 9 หลายเดือนก่อน +1

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

  • @Dylan-ig9pg
    @Dylan-ig9pg 9 ปีที่แล้ว +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

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

    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

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

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

  • @Monyamu
    @Monyamu 5 ปีที่แล้ว +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.

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

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

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

    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

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

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

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

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

  • @شخصمعتزل
    @شخصمعتزل 29 วันที่ผ่านมา +1

    Really you helped me a lot

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

    great video , short and very precise

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

    Best simplest possible explanation. Thank you

  • @MemoUlloah
    @MemoUlloah 2 หลายเดือนก่อน

    Great, now that I know clearly how to "run" this algorithm, I'd like to know regularly what type of uses are given to this technique?

  • @vickylance
    @vickylance 11 ปีที่แล้ว +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 10 ปีที่แล้ว

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

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

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

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

    This is so helpful to review for final exams. 😄

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

    Sir,u totally saved my ass.The book was so freakin confusing,i felt like this shit was out of my grasp.Thanks a lot 😀

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

    I thought I was going to fail my exams, but thanks! I know what it is now!

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

    Nearing the end of video, still couldn't find my breakfast

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

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

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

    Thanks man! This + DFS helped!

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

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

  • @souravu5121
    @souravu5121 4 หลายเดือนก่อน

    11 years old Video but content 10/10

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

    I got lost when C was the selected node , you left G there

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

    This video is very clear and very easy to understand

  • @pavarayaa
    @pavarayaa 6 ปีที่แล้ว +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.

  • @badwaikrohit
    @badwaikrohit 10 ปีที่แล้ว +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.

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

    Great explanation and illustration, thank you.

  • @white-w7l
    @white-w7l 5 ปีที่แล้ว

    shouldn't we go left to right node from root instead of choosing alphabetically?

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

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

  • @10joaaa
    @10joaaa 6 ปีที่แล้ว

    Very clear and simple explanation, thank you.

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

    Is it compulsory to visiting adjacent nodes in lexical order?

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

    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?

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

    Great explanation, thank you uploading this.

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

    Simple yet Superb explanation. Thank you.

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

    Maintain level, check and see if all elements in a level are visited. then move to next level marking a new root in the recently visited level.

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

    That is a beautiful Indian accent.

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

    Very clear and understandable example, thank you very much

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

    Very clear explanation, thank you.

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

    Getting ABSCGDFEH is it correct?

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

    Tysm 4explaining within short span of time 😊😊

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

    May I know why the order is A -> B -> S but not A -> S -> B ?

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

      Alphabetical order. Always start from the earliest letter. Like how S goes to C first than G.

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

      thx a lots

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

    Y the node A not enqued into the queue?

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

    I tried to implement it into Python:
    def bfs(graph,start):
    visited , queue = list(),[start]
    while queue:
    vertex = queue.pop(0)
    if vertex not in visited:
    visited.append(vertex)
    queue.extend(graph[vertex] - set(visited))
    return visited
    graph = {'A':set(['B','S']),'B':set(['A']),'S':set(['A','G','C']),'C':set(['D','E','F','S']),'G':set(['S','H','F']),'F':set(['G','C']),'D':set(['C']),'E':set(['H','C']),'H':set(['G','E'])}
    print(bfs(graph,'A'))

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

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

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

    Simple and clear explanation, thank you!

  • @petru-alexandru
    @petru-alexandru 4 ปีที่แล้ว

    I passed the exam. Thanks 💪💪

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

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

  • @aurelienregat-barrel9217
    @aurelienregat-barrel9217 8 ปีที่แล้ว

    That's well explained. I don't understand why you get +100 downrates???

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

    AWESOME, you put it so simple.. thanks

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

    Why do you cue B first? Why not S? is it random?

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

      Alphabetical order

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

    What do you use to compress your video?

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

    Great vid, simple and on point!

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

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

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

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

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

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

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

    Absolutely crystal clear!

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

    Excellent explanation - thanks!

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

    great video thanks for the short length

  • @DeepakRaj-dc5vg
    @DeepakRaj-dc5vg 5 ปีที่แล้ว

    ase hi mehnat krte rho ... gazabb

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

    Great vid. Nice and simple.

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

    POP IT OFF I love it thank you

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

    All I can Say is Thank You

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

    short but sweet...nice explanation

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

    Life saver for all computing students :D

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

    Thanks a lot, very clear explanation.

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

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

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

    I heard this is superior to the other, but I fail to see how, I guess because it keeps smaller tracks.

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

    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?

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

    Very well explained ! Cheers !

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

    It is really helpful , when you don't have much time to study :p

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

    concise and good explanation. Thanks !

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

    Too bad you didn't color the once already visited in red and the ones that are out of the queue in black that way we couldve noticed how the algorithm differentiates between the nodes

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

    How would it look if you used a stack?

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

    Very helpful, thank you.

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

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

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

    why cant we take node S first??

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

    Why cany we start with B as startin node?

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

    many thanks for this video! :)

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

    i m not getting this how can u enqueue and dequeue alphabetically ???? first b and then s ? why not s first and where is front and rear elements .. plzz help i m a rokieeeee

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

    Great explanation! to the point!

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

    Thank you very much - very clear and easy to understand!

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

      Hey man are you a Gunner? #LondonIsRED #COYG

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

      London is always BLUE. #KTBFFH

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

      #YaGunnersYa

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

      #BLUEisTheCOLOR
      Chelsea >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Arseanal

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

    Why the enqueue should be done in alphabetical order?

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

      I don't think it really matters, he just wants to keep it consistent

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

    YOU MUST START BY PUTING A in the QUEUE and dequeueing etc...

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

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