Well. If you see overall Time complexity is same. O(V + E), but if bfs, indegree operation is extra, so it'll have extra operation cost as well It's taking extra space to store Indegree in HashMap. - So though Time complexity & space complexity both are linear in both approach, due to Indegree, bfs have more operation cost. Thanks.
Literally the only video on this topic that makes sense.
Thanks for your nice feedback. Keep Watching.
I waited 26 min, but in the end I can say its totally worth,
Your examples in b/w helped a lot to get the crux,
Wonderful explanation man,
Thank you
Thanks for your nice feedback. Keep watching our other videos as well.
I think on the graph this is most valuable content on youtube . I have searched so many content on graph but i found this is the most valuable..
Thanks Hemant for your nice feedback. Keep watching.
Really after watching 2-3 videos. I got it from you. Thank you.
Cool.
your explanation helps me a lot i always find your video on youtube for any kind of coding problem
Thanks for your nice feedback. Keep Watching.
This is pure gold. The best explanation on youtube.
Thanks for your nice feedback. Keep Watching.
Sir better than gfg explanation 🙌🙌
Thanks for your nice feedback. Keep Watching.
thank god i got a java tutorial again
Thanks for your nice feedback. Keep Watching.
Nice explanation. I like this more than the previous bfs one. Which is more optimal though?
Well. If you see overall Time complexity is same. O(V + E), but if bfs, indegree operation is extra, so it'll have extra operation cost as well It's taking extra space to store Indegree in HashMap.
- So though Time complexity & space complexity both are linear in both approach, due to Indegree, bfs have more operation cost. Thanks.
What do you do?
You are working?
The best explanation
Glad you liked it. Keep Watching.
Will the BFS indegree method to detect cycle will work when there is self-edge loop ??
yes
Visited[index]=true;
This one line code is not needed I feel.
Rest code is good..
Can you give me clarity for the mentioned code line code
most elegent explanation
Thanks Rohan for your feedback. Keep Watching.
Wonderful explanation I will give 5 star 👍👍
Thanks for your nice feedback. Keep Watching.
I just have a small doubt why can't we use a similar approach to find a cycle in the Directed graph as we used for Undirected graph.
can we used HashMap in place of recursive stack
best explanation
Thanks for your nice feedback. Keep Watching.
really a great explanation
Thanks. Keep Watching.
In ur example what if there is edge from 3 - 0 instead of 0-3 . I think it will not work
is it possible to solve using only visited array?
Visited array is just helper variable. You need to have DFS thing which is necessary here.
how to edit multiple line in Eclipse
Alt + shift + R is another way of refactoring, but I would suggest to search on google as per your specific request. Hope it helps you. Thanks.
best explanation
Thanks for your nice feedback. Keep Watching.