Wow are you the Tam from Big bang theory? Sheldon's childhood bestfriend? :O Sheldon could have taught you this and whole computer science if you had asked him.
Suppose we go in the order of A B and then E, what condition would make it go to F but not C? Would the order A B E C F D also be a depth-first traversal?
It depends on the graph internal implementation and how you have added edges. Suppose for node E, you add an edge, EF in the graph before EC. So what happens is, the array storing edges for E would be E --> [F, C]. So when your DFS hit node E, it will look for its first child that is F and here you go other way. Basically, if you have used same graph class, the only way your DFS would come out different if the you have added edges in different order.
because E and D are the two adjacent vertices of B. Here F is adjacent to D or E . So first you have to visit E or D. Order is not important like B --> D or B --> E both are correct.
here stack is using for back-tracking. I think in this video the program is written in c++. Use java for implementing a Stack data structure. watch this czcams.com/users/redirect?q=http%3A%2F%2Fwww.geeksforgeeks.org%2Fdepth-first-traversal-for-a-graph%2F&v=Y40bRyPQQr0&event=video_description&redir_token=z8iambMT2HOvNRQN0rrqubjpCx18MTU4ODkyNTc1N0AxNTg4ODM5MzU3
Once you understand the algorithm, then the code would be easy to write. If you can't write it, then it means you haven't fully understood the algorithm.
at 1.25 speed it looks good
2.0 is even better
hahaha
lol.
lol i just skipped past intro
Na brauhh I tried 2×
"This video is contributed by Illuminati." woh... what?
Illuminati is now making programming videos😂😂
😊@@lokeshjawale1562
Excellent Job, Thanks for your service
This video helped me a lot. Thank you.
You gave us the idea using stack, but implementing recursively on website/example.
Recursive implementation uses the implicit stack (in memory). So, it's kinda stack-based implementation.
how do you mark as visited on template values?
after visiting E why we are not visiting C (alphabetically).I think we have to visit C first and then F
You can do it whatever you want.
True
you can visit either adjacent node. The letters he put are arbitrary, just a visual to help us understand it
why we use only stack in dfs but not queue
excellent videos! I thoroughly understand graphs now
Plz write n explain psuedo or algorithm.
This video works for me. I understand the concept now. Thanks!
Wow are you the Tam from Big bang theory? Sheldon's childhood bestfriend? :O Sheldon could have taught you this and whole computer science if you had asked him.
@@ShiShiva439 I’m a big fan of the show, not as smart as that Tam but cuter :)
@@ShiShiva439 hahahahaahhaahahah
Please ,make a video lecture for GetPath_DFS problem.
Suppose we go in the order of A B and then E, what condition would make it go to F but not C? Would the order A B E C F D also be a depth-first traversal?
yea,,,its not clear,,,,why do we even go E from D,,,,we were going left first,,,suddenly we go e but not F
It depends on the graph internal implementation and how you have added edges. Suppose for node E, you add an edge, EF in the graph before EC. So what happens is, the array storing edges for E would be E --> [F, C]. So when your DFS hit node E, it will look for its first child that is F and here you go other way. Basically, if you have used same graph class, the only way your DFS would come out different if the you have added edges in different order.
Please order the playlist properly
How we can visit E after D if we are following depth first? Isn't it making this a breadth first approach ?
True
Actually BFS needs to have B and C together
depends on what is the first child
Why you visit F from E instead of C as C comes first in alphabetical order?
I agree with you. I thought the order was A,B,D,E,C,F
Same here
Doesnt matter you can do it anyway..it has nothing to do with alphabetical order.
Can i visit node f from d instead of e? if yes then my answer would be ABDFEC. Will it also be correct?
@@sumeetnegi9926 yes
Is this traversal unique?.. I mean does it give a unique traversal?
why u choose node F after node E? why not node C?
you can also use c if you want
c must pushed to stack and visited before f since c is comes before f alphabetically
that's what I think
#same thinking
There is no such rule.....You can choose any of the nodes,
Dawit Keba This is false
thanks illuminati for the contribution
Best video I have ever seen ,in no time all my concepts are clear ❤
i want to ask why did u visit E after D, why not F?? I'm confused about it
because E and D are the two adjacent vertices of B. Here F is adjacent to D or E . So first you have to visit E or D. Order is not important like B --> D or B --> E both are correct.
Can i visit node f from d instead of e? if yes then my answer would be ABDFEC. Will it also be correct?
Sumeet Negi yes bro it is also correct
@@shivaay448 you sure mate?
That means, output of many students can be differ with each other ?
For the same graph it should not be. If you put edges in different order then it may differ.
i could not find stack in gfg code
Are two or more answer possible in DFS??
Yes. It may differ in directed and undirected graph
Yes, if you're doing it manually.
thank you sir...
Thanks for notes but you didn't clarify the most important thing which is the code
If u get the algo u get the code
Sir please explain us code
After reaching E why we haven't take C but took F
Inderjeet Agarwal bcz we have to choose depth first
You can choose whichever you want, they both fit in the criteria
But the stack is not used here, it is a recursive approach.
plz explain code also
Thank you for your valuable feedback.
Where is the use of stack here?????
here stack is using for back-tracking. I think in this video the program is written in c++. Use java for implementing a Stack data structure. watch this czcams.com/users/redirect?q=http%3A%2F%2Fwww.geeksforgeeks.org%2Fdepth-first-traversal-for-a-graph%2F&v=Y40bRyPQQr0&event=video_description&redir_token=z8iambMT2HOvNRQN0rrqubjpCx18MTU4ODkyNTc1N0AxNTg4ODM5MzU3
The stack is used internally
While doing recursion....
Thank u
I want dfs and bfs with graphics
the order should be ABDECF if u follow alphabetically
CodePatchers yes... Is it wrong here??
*watch at 3x*
Maximum of 2x is there !! how to watch videos at 3x speed ????
@@prasannakumar7035 Chrome extension
@@prasannakumar7035 Chromium extension
u just explain only the algorithm......but what about code.....F
Once you understand the algorithm, then the code would be easy to write. If you can't write it, then it means you haven't fully understood the algorithm.
Thanks I am a Bangladeshi student
DFS GOD
what the hack is going on man
i love u
A,B,D,E,C,F it should be
Wrong
czcams.com/video/Y40bRyPQQr0/video.html Here comes the D xD
you are doing absolutely wrong man this is DFS or BFS
No.
This is not DFS bro
This is DFT.
gay
so tru lmao