How to Find Path in Graphs using Depth First Search | Graphs in Data Structures

แชร์
ฝัง
  • เผยแพร่เมื่อ 22 ธ.ค. 2024

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

  • @ankoor
    @ankoor 3 ปีที่แล้ว +35

    One of the best explanations of DFS. I am glad you take time to dry run with diagrams as it helps understand at deeper level. Some coding related TH-camrs have more views/subscribers but they do not explain half as good as this instructor. Amazing in depth analysis!

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

      Glad you enjoyed it!
      If you like our efforts, will you like to write a few words about us here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )

  • @93dssagar
    @93dssagar 3 ปีที่แล้ว

    Yeh banda samjhaye aur dimag mein naa utre aisa ho hi nai sakta.....thanks for such a vivid explanation guruji.

  • @pranjalchourasia9923
    @pranjalchourasia9923 3 ปีที่แล้ว +12

    I guess Pepcoding is one of the most underrated channels. Sumeet Sir provides such premium content for free. He should get more views. I have taken DSA courses from other big platforms but their quality and quantity isn't even close to this. Thank You, sir.

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

      Glad to know that you liked the content and thank you for appreciating.
      The love and respect which I get from you people keep me highly motivated and the same I am able to forward It to you people through my videos.
      So, keep motivating, keep learning and keep loving Pepcoding😊

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

    Sir, you know what is the best thing about pepcoding and you? You guys give significant amount of time to things until we understand the concept clearly,you already know that where we are going to have doubt and you put emphasis on that part and it become crystal clear then whereas in other channel they explain whole thing in just 10 min, that's why pepcoding is best

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

    I have never had a good grasp of ds algo, but with your videos sir it has been the biggest and only help. SIr please never stop making videos.

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

    I am now able to solve the graph questions by myself(for the first time). All credit goes to you, Sir. Best tutorial for graph on the web.
    Thank you so much, Sir

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

    Great Explanation!!, the thing I was known about visited was never to visit that vertex, but when I saw Sir's explanation, now I actually/practically got to know with dry run, how that absence of visited array impacted the flow, no one explains this,
    Thanks a lot for such great explanation, even dry run became more strong after watching this video...

  • @VikasGupta-ok9lh
    @VikasGupta-ok9lh 2 ปีที่แล้ว

    The beauty of this course is you know how things are working

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

    Amazing analysis Sir. The drawings are really helpful. Keep up the great work.

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

      Thanks, will do!

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

    This is how I reached to this video....
    Started watching number of island problem,
    then there was a reference to connected graph
    then came to connected graph
    then there was a reference to graph traversal
    so came here
    now here flood fill reference is there and I am going to watch that first :)
    Main Point: I am loving your explanation and not able to leave your video
    This is first time I got courage to even learn about Graphs because of the simple explanation :)
    Thanks :)
    Keep up the good work please.... :)

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

      Glad you love our explanation .
      For better experience sign up on nados.io
      And don't forget to follow us on Instagram instagram.com/pepcoding/

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

    Your lectures have always been my goto place for revision... very intuitive explanation, sir...

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

      Glad you liked it !! Share among your peers

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

    There is no words to appreciate the effort you are giving to enlighten us every moment

  • @45_ritiksharma32
    @45_ritiksharma32 4 ปีที่แล้ว

    He is first teacher who replies to all student !!
    Great explaination !!

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

      Thank you for the kind words.

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

    sir great explanation will finish the whole playlist!These videos have really improved my thinking capability.

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

      Thankyou beta!!We r glad my beta😊

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

    This is pure Gold sir, you simply rock Sumeet sir..Thank you so much for such wonderful content ❤ Specially, the dry run part.

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

    This is a pure diamond! Thanks a lot sirr

  • @mr.naresh3004
    @mr.naresh3004 3 ปีที่แล้ว

    one of my favorite channel thanks for providing such content sir...

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

      Keep learning.
      And for better experience and well curated content explore nados.pepcoding.com

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

    This guy is a genius when it comes to explaining complex topics. I am feeling better now.
    Good bless you Sumeet Sir.
    Sir wese abb Level up ke question nahi aayenge kya? I mean 10-15 dino se nahi aa rahe hai questions.
    It's a request ki aap please usse pura krr do atleast Dp and Graph of level up.
    Baaki sab badiya hai sir

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

      Thankyou beta,
      I am glad you liked it. If you like our efforts, will you like to write a few words about us here (www.quora.com/How-do-I-start-learning-or-strengthen-my-knowledge-of-data-structures-and-algorithms )
      Aayege beta, jaldi he. Till then, stay tuned.

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

    ohh... My god such a great explanation........Loved it😍😍😍😍

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

    Excellent sirji 👍👍

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

      Thankyou beta!
      Keep learning and keep loving Pepcoding😊

  • @magic.pencil2.0
    @magic.pencil2.0 2 ปีที่แล้ว

    Thank You so much sir for this amazing video. Even though I am from CPP background I get all the points U told 💯

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

    aisa dry run koi nahi karta...thanks Sumit bhaiya

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

    Great Explaination!

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

    in case Vertices 0-7 ke range me na hokar ke kuch bhi kuch aur nums hite like 10, 43, 78879, etc any numbers then is case me Map me in verices ki value as key and ArrayList as Value of map ke taur pe used kia jaa sakta hai kya??? please ans .

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

    Worth watching it.

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

    What is the solution of "Cant create generic array of arraylist" ??

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

    😍😍😍nice explanation sir!!

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

      Thankyou beta!
      I am glad you liked it. I hope that you are watching till the end and trying to understand what, how, and especially why of the problem.
      If you like our efforts, will you like to write a few words about us here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )

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

    you cant create array of generic classes ,it will give compile time error
    Demo.java:20: error: generic array creation
    do arraylist of arraylist instead

  • @ManishTiwari-ge1wc
    @ManishTiwari-ge1wc 4 ปีที่แล้ว +1

    Excellent explanation.

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

      I am glad you liked it. I also hope that you are watching till end and trying to understand the what, how and especially why of the problem.
      If you like our efforts, we request a review - g.page/Pepcoding/review?rc

  • @PradeepYadav-fg2yg
    @PradeepYadav-fg2yg 2 ปีที่แล้ว +2

    extremely well explained and i wonder how this channel has just 103k subscriber please people share this as much you i am also sharing, help your friends and this channel grow

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

      These words really mean a lot, for better experience and well organised content sign up on nados.io and start learning.

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

    Why are Graph questions not available in java foundation series on the pepcoding website??

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

      We will make them available today

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

      @@Pepcoding Ok sir thank you very much 😄

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

    Gr8 explanation sir.

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

      Thankyou beta!
      Will you like to write a few words about us here (www.quora.com/Which-is-the-best-institute-for-coding-in-Delhi)

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

    Good explanation

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

    thanks sir for such a informative lecture :)

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

    Awesome explanation..❤️

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

    Sir recursion ke bad ye sab mst lagta hai

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

      Yahi to chaie

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

    why backtracking step is not there in this?

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

    Super explanation!

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

      Glad it was helpful!
      Keep learning.
      And for better experience and well organised content visit nados.pepcoding.com

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

    Graph ki playlist porri nahi hai na?? pepcoding.

  • @RahulGupta-xc4fg
    @RahulGupta-xc4fg 3 ปีที่แล้ว +2

    sir, the Dark Mode on website looks pretty awesome :)

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

      Thankyou😊

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

    After the the explanation of this question i am the Jabra fan of sumeet sir

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

    great explaination sir

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

      Glad you liked it!
      Keep learning.
      And for better experience, visit nados.io, where you will get well curated content and career opportunities.

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

    for loop samj nhi aya
    can some one explain me>
    for(ArrayList edge : graph[src]){ // array ka andar list hai, list liye q nhi loop nhi lagaya and how edge.nbr is valid ?
    }

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

      for(Edge edge : graph[src] )
      This is the right syntax.
      We are taking a object / variable 'edge' of class Edge type to access the array list of edges.

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

    ArrayList[] graph=new ArrayList[vtces];
    ye line pr "cannot create generic array of arraylist" error aa raha hai

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

      ArrayList graph = new ArrayList();
      for(int i=0;i

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

    sir agar ye visited[src]= true for loop ke bad krte toh koi error aati kya?

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

      han beta, stack overflow ho jata.

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

    sir do you have explanation in c++ also if yes please provide link

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

      Yes, please check c++ video of this same content on nados.pepcoding.com

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

    Nicely explained

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

      Thankyou beta!
      I am glad you liked it. I hope that you are watching till the end and trying to understand what, how, and especially why of the problem.
      If you like our efforts, will you like to write a few words about us here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )

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

    isVisited[src]= false kyon nahi kiya?? flood fill mein to kiya tha

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

      Beta, I regret to inform you that, I won't be able to answer/solve the personal doubts of each and every student over here. For clearing your doubts, you can join our community on telegram - t.me/pepcoding.

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

      @Sharath Kumar did you get answer for why visited[src] = false is not done ? I have the same query....Can anybody else help us here ?

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

      @@subbucs5674 sorry I don't remember it now Did it a month ago right

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

      @sharath.kumar
      In flood fill, we traverse each cell multiple time, hence we need to set visited[I] = false.
      But, To traverse graph - we need to traverse each node only hence we do not need to set visted[I] = false.

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

      @Sahil Raj are you trying to say - by not writing visited[I] = false, we are doing some optimization?
      I don't think "not writing visited[i] = false" is an optimization technique... Instead, it is a mandatory code statement to make sure that each node is visited only once in SINGLE traversal - if want to multiple traversal then we need to write visited = false.

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

    Flood fill me visited ko false bhi karte hai hum, yaha kyu nahi kiya?

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

    loved it

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

    Mohit Tyagi of Computer Science .

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

    Thank you sir 💓

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

      Most welcome. Please share and subscribe

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

    Some hardest problems please

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

      Levelup ki backtracking aane ko hai. Ekdum sahi lagegi

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

      @@Pepcoding parallely ek ek que doosre topics ka v daal do :), jo khi usually covered na ho .Thanks a lot

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

    sir, i am from PIET college haryana... do you know about our college... how are the placements here?

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

      beta PIET to nahi suna.

  • @shivamkumar-qp1jm
    @shivamkumar-qp1jm 4 ปีที่แล้ว

    Have you not used stack anywhere

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

      Last question

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

    Please try to write code in c++ also

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

    ArrayList[] graph=new ArrayList[vtces];
    Sir please thoda sa ye explain kar dijiye thoda mushkil hora h graphs abhi

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

      arey graph wali first video pehle dekhie na
      yahan se kijie
      www.pepcoding.com/resources/online-java-foundation/graphs

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

    Sir path print krna chaiye n

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

    ArrayList edge:graph [src]
    how this line produces neighbours

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

      for(Edge edge : graph[src] )
      This is the right syntax.
      We are taking a object / variable 'edge' of class Edge type to access the array list of edges.

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

    Or ye mai 10:58 pe ja rha hu flood fill dekhne😑😂

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

    Aap neighbour ke pichhe neighbour aapke pichhe too much fun

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

      🤣🤣🤣🤣🤣

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

    Nice

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

    Peepcoding doesn't have - ve comment.
    5 🌟

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

      keep motivating, keep learning and keep loving Pepcoding😊

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

    Flood fill m aesa btaye the

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

    Generic array creation error🤕

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

    Has anyone attempted this Q in c++?

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

    sir please make one is cpp also

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

      beta ye to next year karunga

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

    Guru ji aap pahle ku ni mile :)

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

    Typo in name

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

      Thanks for reporting.

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

    neighbor badmas h sir, sath me le k nahi ja rha!

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

    All good, but is it english? I can not understand, sorry

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

    Saare not 1

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

    recursive solution without using visited space
    import java.io.*;
    import java.util.*;
    public class Main {
    static class Edge {
    int src;
    int nbr;
    int wt;
    Edge(int src, int nbr, int wt){
    this.src = src;
    this.nbr = nbr;
    this.wt = wt;
    }
    }
    public static boolean has_path(ArrayList[] graph,int sr,int de,int l){
    if(l==graph.length){
    return false;
    }
    if(sr==de){
    return true;
    }
    boolean a=false;
    for(int i=0;i