Iterative Depth First Search (DFS) traversal of an Undirected Graph | Animation

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

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

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

    Best series for DS & Algo. I am also 10 yrs java exp guy. Was looking for DS & Algo free course over TH-cam with java implementation and found this. Hats Off To You Man...Excellent Work. GOD BLESS YOU :)

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

    Please *Like* , *Comment* , *Share* , *Subscribe* and *Click Bell* 🔔🔔🔔 Icon for More Updates. To get *Data Structures and Algorithms* complete course for free please follow this link - th-cam.com/play/PL6Zs6LgrJj3tDXv8a_elC6eT_4R5gfX4d.html

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

    Hi Dinesh..
    Following your videos from long back.
    The way you explain the algorithms are marvelous and I know it takes lots of hard work and patience to create an animated videos.
    Thank you for help to let us understand the concept.
    One request ,please make some videos on matrix interview questions.

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

      Thanks !!! Sure will add one matrix question next !!!

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

    Best explanation of both Bfs and dfs

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

    Sir, if here just we use Queue ds instead of stack, i guess it will give BFS.
    So, in the previous video, the code for BFS could be altered with this right?

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

      BFS deals with queue ... DFS deals with stack ...

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

      Stil didn't get why ????

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

      @@itsdineshvaryani so, if we use bfs implementation by Stack Except Queue then is that a solution of DFS??

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

    What if the node has values 21,22,76,45 means not in a sequence

    • @Danieru13
      @Danieru13 8 หลายเดือนก่อน

      How would that matter?

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

    @Dinesh Sir......... Can we have output as 0,3,2,1,4??

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

    Sir, can you please make some videos on graph algorithms like djiktra's and prim's etc

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

    sir pls add more videos on dsa

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

    Thanks sir

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

    hello sir,
    public void dfs(int s){
    boolean[] visited = new boolean[ver];
    Stack st = new Stack();
    visited[s] = true;
    st.push(s);
    while (!st.isEmpty()){
    int u = st.pop();
    System.out.print(u + " ");
    for (int v : arr[u]){
    if (!visited[v]){
    visited[v] = true;
    st.push(v);
    }
    }
    }
    }
    this is the same code of BFS from your previous video , I just alternate Queue with Stack and it's work properly in DFS . so , is it can be solution??

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

      Bro is it right solution ?

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

      @@yyashraut yes bro it’s right