G-21. Topological Sort Algorithm | DFS

  Рет қаралды 330,493

take U forward

take U forward

Күн бұрын

Пікірлер
@takeUforward
@takeUforward 2 жыл бұрын
Let's continue the habit of commenting “understood” if you got the entire video. Please give it a like too, you don't 😞 Do follow me on Instagram: striver_79
@arjunrai8126
@arjunrai8126 2 жыл бұрын
Understood
@pulkitjain5159
@pulkitjain5159 Жыл бұрын
@pulkitjain5159 0 seconds ago LET ME GIVE WHAT I UNDERSTOOD AS AN INTUTION Agar isko Task Completion ke perspective se dekhe such that if A -> B is like ki A wala task complete karne ke liye B wala task complete hona jaroori hai. toh hum dfs ke through bas yeh keh rahe hai ki dfs(task , completedTasks){ visited[task] = true; // mene yeh task karna start kardiya hai // par mujhe pata laga yeh task toh bakiyo pe dependent hai , toh phele mein unko khatam karke ata hu // let task on which my current task is dependend on be "dep". for( int dep : adj[ task ] ){ if(!visited[dep]){ // agae yeh dep abhi tak khatam nahi hua hai dfs(dep , completedTasks); // phele m isko complete kar leta hu } } // ab jab saare tasks jinpe mein depend karta hu khatam hogaye toh completedTask.push(task); }
@artofwrick
@artofwrick 9 ай бұрын
Why can't we add codes in comments?
@srinayclg390
@srinayclg390 Жыл бұрын
Many coder who know all this things but cannot explain well, but u r the different beast who can do both single handedly !!!!
@harshniteprasad5301
@harshniteprasad5301 2 жыл бұрын
Revising through this playlist before an interview is a bliss. INTUITION : incase you faced some trouble , taking in consideration the graph 1->2->3->4 we start with the dfs(1) we keep calling it for the adjacent nodes and at the very end we reach dfs(4) WHICH DOES NOT HAS ANY ADJ NODE, thus we put it in the stack stating that there is no node it needs to point after completion we push 3 in the stack stating that all the nodes pointed by 3 must already be the stack, same way we go up and at the end we push 1 in the stack stating that all the nodes pointed by 1 are already in the stack in a linear order. Linear order if a node v points to u then v comes first then u.
@sayandey2492
@sayandey2492 Жыл бұрын
And if it is reverse of topological ordering? Use Queue :P
@varunaggarwal7126
@varunaggarwal7126 Жыл бұрын
@@sayandey2492 by playing with where you place stack during recursion you can use stack only.
@pulkitjain5159
@pulkitjain5159 Жыл бұрын
@pulkitjain5159 0 seconds ago LET ME GIVE WHAT I UNDERSTOOD AS AN INTUTION Agar isko Task Completion ke perspective se dekhe such that if A -> B is like ki A wala task complete karne ke liye B wala task complete hona jaroori hai. toh hum dfs ke through bas yeh keh rahe hai ki dfs(task , completedTasks){ visited[task] = true; // mene yeh task karna start kardiya hai // par mujhe pata laga yeh task toh bakiyo pe dependent hai , toh phele mein unko khatam karke ata hu // let task on which my current task is dependend on be "dep". for( int dep : adj[ task ] ){ if(!visited[dep]){ // agae yeh dep abhi tak khatam nahi hua hai dfs(dep , completedTasks); // phele m isko complete kar leta hu } } // ab jab saare tasks jinpe mein depend karta hu khatam hogaye toh completedTask.push(task); }
@sakshammisra189
@sakshammisra189 Жыл бұрын
@@varunaggarwal7126 exactly what i was thinking , the moment you insert the ele should be made at the start and not end , regular dfs is rev topo i guess ?
@akash_assist
@akash_assist 8 ай бұрын
great comments , it's okk for understanding, actually great but code is actually working in backtracking way, so not exactly fitting...... mtlb ki phle hum uss element ko khoj rhe hain jo sbpe dependent hain (dfs(1) agar dfs(2) ko call kr rha hain mtlb 1->2 ja skte hain mtlb ki 2 ko krne ke liye 1 ka hona jruri hain, lekin yha hum sbse phle 2 ko stack mein dalenge then 1 ko so that 2 sbse niche chala jaye,) isse jo kaam sbse phle krna hain, jo kisi pe dependent nhi hain wo top pe aajayega@@pulkitjain5159 this is from my understanding, please correct if i am wrong.🙏
@decepticonWave
@decepticonWave Жыл бұрын
The problem with this solution is that if you are given a directed graph that contains a cycle in the solution. The algorithm wont be able to detect, it will spill out an ordering which is wrong. But when using khans algorithm, you will be able to detect whether top. sort was possible or not.
@guptashashwat
@guptashashwat Жыл бұрын
+1
@tanyasingh2344
@tanyasingh2344 Жыл бұрын
Yeah but he already mentioned it is for Directed Acyclic Graph so it won't work in Graphs containing cycles.
@salmankhader1258
@salmankhader1258 Жыл бұрын
But you can check the size of your topological sort array and if it is equal to number if vertices it is a valid one otherwise not.
@kartikdalai7998
@kartikdalai7998 Жыл бұрын
C ho tum
@uditgarg6508
@uditgarg6508 Жыл бұрын
that is completely wrong@@salmankhader1258
@AquaRegia-i3u
@AquaRegia-i3u Жыл бұрын
Quick Tip : If you are thinking, why don't we put into list when you start dfs, this way we don't have to use stack or reverse order. Consider a case 6->0->1->2->3->4->5, we start from 0 and put into list, so ordering comes out to be, 0,1,2,3,4,5 and then we check for 6, so 6 at last, but this is wrong. Hence we cannot put into list when starting the dfs, because we dont' know if 0 was coming from somewhere else. Hence we put into list at last and then reverse(or use stack and pop). So ordering becomes 5->4->3->2->1->0 and then we check for 6, so 5->4->3->2->1->0->6 and reversing this is correct topo.
@vinayjangra1401
@vinayjangra1401 Жыл бұрын
Thanks bro !!
@crosswalker45
@crosswalker45 Жыл бұрын
Why 6 cannot be in last?
@AquaRegia-i3u
@AquaRegia-i3u Жыл бұрын
@@crosswalker45 Because 6 is at starting of topo sort and not last. It is even before 0, since we started from 0 doesn't mean our topo start from 0.
@priyanshkumar17
@priyanshkumar17 6 ай бұрын
Thanks
@awesome_latest_virals6098
@awesome_latest_virals6098 Жыл бұрын
we can use bool array instead of int array to mark visited....it will take less memory.
@ChiragDhamija-b4n
@ChiragDhamija-b4n 4 ай бұрын
Hey striver Instead of using a stack we can directly store it in a vector and write ans.push_back(node) and just when returning the final anwerr we can reverse this vector This will help us to optimize the space complexity
@tummalapallikarthikeya2412
@tummalapallikarthikeya2412 2 ай бұрын
yeah! same opinion
@SD-vk3ko
@SD-vk3ko 2 жыл бұрын
Hey Striver, Thank you for the amazing content. But I request if you could add some problems on Union Find as well. Thanks in advance!!!
@yeshagarwal431
@yeshagarwal431 2 ай бұрын
Making graph feel as easy as binary search something only very few like striver can do!
@vineetatiwari5060
@vineetatiwari5060 2 ай бұрын
One corner case - Say if we get nodes in queue that have 0 indegree plus 0 adjacent node as well, this will give us incomplete answer. 10 9 dhhid dahi cedg fg gdah i gbdei hbgf e ddde Here, in queue -> 0,1,9 will be added and none of them will have adjacent nodes as well so our answer will become incomplete. So always check the length of your topo answer whether its equal to k or not. If it is equal then return the string otherwise empty string. PS - We can use visited array also here.
@stith_pragya
@stith_pragya 11 ай бұрын
Thank You So Much for this wonderful video.................🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻
@hah314
@hah314 Жыл бұрын
Can't express it in words, your content is out of the world, really amazing bro❤❤
@abhijeetkumar2970
@abhijeetkumar2970 Жыл бұрын
The intuition behind the problem: The hint here lies in the definition of topological sort as we need the least dependent element first we add it at last(thus using stack). When a node finishes all it's calls, all the elements that should come after it would already be inserted to the stack and now we only need to add current node to the stack. Thus we can be confident about adding node to stack as all it's children are already processed.
@artofwrick
@artofwrick 9 ай бұрын
A > B >C and A>D>C. How does that work with a stack?
@abhijeet19403
@abhijeet19403 9 ай бұрын
​@@artofwrick At first make the adjacency list A- B,D B- C D- C Also make a visited array Start traversing from A to D At first A is not visited so mark it visited and call it's neighbors As B has also one neighbor we call it C has no neighbors (or child nodes) so the dfs stops and we add C to the stack Then B is added as now it has no more children Then D is called from A D tries calling it's children (C here) but it is already visited so we simply add D to stack At the end A is also added to the stack Thus the final contents of the stack are A D B C which is a valid topo sort
@arushimathur7205
@arushimathur7205 Жыл бұрын
Great Work Striver. Thanks for always helping us !!
@the_curious_engineer
@the_curious_engineer 4 ай бұрын
whenever your heart is broken , don't ever forget you are golden..
@yashcoder291
@yashcoder291 Ай бұрын
golden nhi , goal then
@the_curious_engineer
@the_curious_engineer Ай бұрын
@@yashcoder291 thanxx for correcting.
@ishangujarathi10
@ishangujarathi10 Жыл бұрын
loved the intuition and explanation striverr bhaii
@CodeMode9313
@CodeMode9313 Жыл бұрын
explained in quite easy manner ..thanks habibi
@shyren_more
@shyren_more 2 жыл бұрын
understood, was able to code up using the logic after your explanation, thanks!
@pulkitjain5159
@pulkitjain5159 Жыл бұрын
LET ME GIVE WHAT I UNDERSTOOD AS AN INTUTION Agar isko Task Completion ke perspective se dekhe such that if A -> B is like ki A wala task complete karne ke liye B wala task complete hona jaroori hai. toh hum dfs ke through bas yeh keh rahe hai ki dfs(task , completedTasks){ visited[task] = true; // mene yeh task karna start kardiya hai // par mujhe pata laga yeh task toh bakiyo pe dependent hai , toh phele mein unko khatam karke ata hu // let task on which my current task is dependend on be "dep". for( int dep : adj[ task ] ){ if(!visited[dep]){ // agae yeh dep abhi tak khatam nahi hua hai dfs(dep , completedTasks); // phele m isko complete kar leta hu } } // ab jab saare tasks jinpe mein depend karta hu khatam hogaye toh completedTask.push(task); }
@noob_coder8926
@noob_coder8926 5 ай бұрын
nice explanation
@jotsinghbindra8317
@jotsinghbindra8317 5 ай бұрын
ek dum sexy explanation bhai!
@kunalarora3885
@kunalarora3885 5 ай бұрын
Very clearly explained @pulkitjain5159, @striver this is what you call intuition
@imafraidjumitebeeinnagang3886
@imafraidjumitebeeinnagang3886 4 ай бұрын
Should have just read this instead of watching the video, so good!
@parthivsinhvaghela6100
@parthivsinhvaghela6100 3 ай бұрын
it is like deadlock
@AppaniMadhavi
@AppaniMadhavi 5 ай бұрын
Even without taking a stack we can do, it is by taking a vector and storing all the node values after completion of that node's dfs, and finally reverse that vector...
@harshith4549
@harshith4549 5 ай бұрын
Why to go all the way to reverse a vector rather than storing it in the reverse order during the dfs. Just create a vector with size of total number of nodes and using a index variable move from the back of vector to the front during dfs. Here's how its done: class Solution { private: void dfs(int start,int vis[],vector adj[],vector& ans,int& index){ vis[start]=1; for(auto it: adj[start]){ if(!vis[it]){ dfs(it,vis,adj,ans,index); } } ans[index--]=start; // Its decrement } public: //Function to return list containing vertices in Topological order. vector topoSort(int V, vector adj[]) { // code here int vis[V]={0}; vector ans(V); int index=V-1; for(int i=0;i
@cinime
@cinime 2 жыл бұрын
Understood! Super amazing explanation as always, thank you very much!!
@dsa_tutorial
@dsa_tutorial Жыл бұрын
Thank you striver for providing such nice content
@sripriyapotnuru5839
@sripriyapotnuru5839 2 жыл бұрын
Thank you, STRIVER 🙂
@suryanshsingh6423
@suryanshsingh6423 5 ай бұрын
Understood. Fantastic explanation❤
@hercules3150
@hercules3150 2 жыл бұрын
Thank you sir iski bahut need thi. Haal hi mai ek question aaya tha aur woh mai nhi kar paya tha
@shubhranginidas6818
@shubhranginidas6818 6 ай бұрын
We should apply the DFS way of Topological Sorting only if the ordering of the resulting sort is checked otherwise should always prefer BFS way of Topological Sorting. WHY? Because if the cycle exists DFS would return all the vertices with wrong ordering but in case of BFS, it wouldn't return all the vertices if cycle exists. So even if we don't go for ordering detection, number of vertices itself would clear whether sorting is possible or not. This is the reason why BFS (Kahn's Algorithm) is preferred.
@antor.morsalin
@antor.morsalin 2 ай бұрын
Amazing Explanation
@lonersunited
@lonersunited 9 ай бұрын
Understood 😊
@rutikjalhare6836
@rutikjalhare6836 Жыл бұрын
GOD level explanation
@kaichang8186
@kaichang8186 2 ай бұрын
understood, thanks for the great video
@rishabhgupta9846
@rishabhgupta9846 2 жыл бұрын
understood,great explanation
@lanslord11
@lanslord11 7 ай бұрын
Intuition part is what made this whole video amazing for meeee
@GeetainSaar
@GeetainSaar 4 ай бұрын
Happy guru purnima ❤🎉
@Learnprogramming-q7f
@Learnprogramming-q7f 6 ай бұрын
Thank you bhaiya
@Maunil2k
@Maunil2k 6 ай бұрын
I believe we need to assume that the given directed graph does not contain any cycle, only then this algorithm using DFS will work.
@CHOWDAVARAPUSAIDEEPAK
@CHOWDAVARAPUSAIDEEPAK 3 ай бұрын
Given , the algorithm achieves the desired output of topologically sorted array , but there can be many no of possible array sequences that are valid for the same graph . So , How do i get an array that's topologically and lexicographically sorted too?
@prajaktachachad477
@prajaktachachad477 7 ай бұрын
Amazingly explained :)
@sakshammisra189
@sakshammisra189 Жыл бұрын
intuition is that we want reverse of the DFS as when dfs is completed then we are inserting which tells us A->B , then we are inserting B and then A , but we reverse it to get A and then B .
@Saurabh-fe2bg
@Saurabh-fe2bg Жыл бұрын
got it!! thanks for this series
@vakhariyajay2224
@vakhariyajay2224 Жыл бұрын
Thank you very much. You are a genius.
@ajith4249
@ajith4249 Жыл бұрын
In Reverse Order # another approach class Solution: #Function to return list containing vertices in Topological order. def topoSort(self, V, adj): # Code here stack=[] def dfs(node,adj,stack,vis): vis[node]=1 for item in adj[node]: if vis[item]==0: dfs(item,adj,stack,vis) stack.insert(0,node) vis=[0 for i in range(V)] for i in reversed(range(V)): if(vis[i]==0): dfs(i,adj,stack,vis) return stack
@himaniupadhyay8201
@himaniupadhyay8201 Жыл бұрын
Thank You sooo much SIR 🙏
@DevashishJose
@DevashishJose 9 ай бұрын
Understood, Thank you so much
@kamikaze9245
@kamikaze9245 2 жыл бұрын
Understood bhaiya
@yashsaxena7787
@yashsaxena7787 Жыл бұрын
g.addEdge(1,2); g.addEdge(1,3); g.addEdge(2,4); g.addEdge(2,5); g.addEdge(3,6); g.addEdge(3,7); why not working for this graph?????
@yashsaxena7787
@yashsaxena7787 Жыл бұрын
#include #include #include using namespace std; class Graph{ private: int V; vectoradj; void topologicalSortUtil(int v, vector&visited , stack&stack){ visited [v]=true; for(int i:adj[v]){ if(!visited[i]){ topologicalSortUtil(i,visited,stack); } } stack.push(v); } public: // constructor to initialize the graph with the number of vertices Graph(int vertices){ V=vertices; adj.resize(V); } void addEdge(int u,int v){ adj[u].push_back(v); } vector topologicalSort(){ vector visited (V,false); stackstack; for(int i=0;i
@priyanshkumar17
@priyanshkumar17 6 ай бұрын
It's working...
@DeepanshiBhardwaj-y1t
@DeepanshiBhardwaj-y1t 3 ай бұрын
Very Well Understood!!
@UECAshutoshKumar
@UECAshutoshKumar Жыл бұрын
Thank you sir 😊
@utkarshsharma1185
@utkarshsharma1185 2 жыл бұрын
understood bhaiya..
@shubhipaul6830
@shubhipaul6830 4 ай бұрын
For a long time I believed topo sort to be hard. Guess one just has to find the right explanation.
@banothutharun2743
@banothutharun2743 4 ай бұрын
understood striver bro
@pranayjain._
@pranayjain._ Жыл бұрын
Understood! Thank you sir
@saranavinash9261
@saranavinash9261 11 ай бұрын
You should have included or referred to the graph representation, so that we can get idea about how the adjacent nodes are stored and traversed.
@bro_code3505
@bro_code3505 2 жыл бұрын
hey striver I want to code like you!!
@vaalarivan_p
@vaalarivan_p Жыл бұрын
4:05 - 7:50
@valarmorghulis9244
@valarmorghulis9244 Жыл бұрын
What I understood from this problem is that "GIve a BFS path using DFS". Is it?
@per.seus._
@per.seus._ 9 ай бұрын
understoood
@swaraj.nalawade.4634
@swaraj.nalawade.4634 2 ай бұрын
class Solution { private: void dfs(int start, vector adj[], int vis[], stack &st){ vis[start] = 1; for(auto &it : adj[start]){ if(!vis[it]){ dfs(it, adj, vis, st); } } st.push(start); } public: //Function to return list containing vertices in Topological order. vector topoSort(int V, vector adj[]) { int vis[V] = {0}; stack st; vector ans; for(int i=0; i
@worthlessguy1621
@worthlessguy1621 7 ай бұрын
understood the assignment :)
@amitp277
@amitp277 Жыл бұрын
Awesome work
@manishprajapat9135
@manishprajapat9135 Жыл бұрын
@take U forward before applying this method we should ensure that no cycle is present ??
@VIRAJBHOSLE
@VIRAJBHOSLE Жыл бұрын
Input is always DAG, so it's not checked. But if input can be cyclic graph, you need to add cycle checks
@priyanshkumar17
@priyanshkumar17 6 ай бұрын
@@VIRAJBHOSLE Yeah, thanks!!!
@tushar_kesharii
@tushar_kesharii Жыл бұрын
FOR REVIEWING THE CODE FOLLOW THIS - class Solution { private: void DFS(int start, vector&visited, vector adj[] , stack&stack){ visited[start]=1; for(auto x:adj[start]){ if(!visited[x]){ DFS(x,visited,adj,stack); } } stack.push(start); } public: //Function to return list containing vertices in Topological order. vector topoSort(int V, vector adj[]) { // declaring a visited array and initially filled with 0 vectorvisited(V,0); stackstack; for(int i=0;i
@yuvrajanand9342
@yuvrajanand9342 Жыл бұрын
only had to watch half of the video and did the coding part all by myself
@tasneemayham974
@tasneemayham974 8 ай бұрын
THANK YOUUU STRIVERRR!!
@anssha2643
@anssha2643 Жыл бұрын
Why aren't we using the path[] here? Is it because its acyclic graph?
@evilpollination1916
@evilpollination1916 6 ай бұрын
Understood Striver bhai. Aapne samjhaya hai toh samjh to aayega. Also bhai aapki tabayt kharab lag rahi thi . Pls take care bhai.
@bestsaurabh
@bestsaurabh Ай бұрын
vis array was not passed as reference, still it worked???
@Rieshu-l9i
@Rieshu-l9i 7 ай бұрын
#Striver rocks 🤟👍
@shivendrasingh8520
@shivendrasingh8520 5 ай бұрын
can we use queue in this question at last we will reverse the queue
@vinaynalluri277
@vinaynalluri277 2 жыл бұрын
everything is nyc except one thing sir if suppose i/p is loop(1,2,3) then s.size==n fails only bfs accepts am i correct i chckd for conditions
@amanasrani6405
@amanasrani6405 7 ай бұрын
understand bhaiya❤🙏🏻\
@user-fx3bn4co5o
@user-fx3bn4co5o 2 жыл бұрын
Its awesome bro
@AdityaKumar-uf5xp
@AdityaKumar-uf5xp 2 жыл бұрын
understood but striver I forgot those code and have to remember everytime . How should I keep remember the code?
@diksha3157
@diksha3157 2 жыл бұрын
Don't memorise the code. Instead, try to understand the logic and then write code. Converting logic into code requires practice.
@Moch117
@Moch117 Жыл бұрын
Memorize the logic. If DFS, and topological sort, use a stack. BFS, use Queue. Both use visited array
@mananarora141
@mananarora141 Жыл бұрын
UNDERSTOOD!!!!!!!
@The_Shubham_Soni
@The_Shubham_Soni Жыл бұрын
UNDERSTOOD.
@kunal4710
@kunal4710 2 жыл бұрын
UNDERSTOOOOOD😊
@sumerrawat6947
@sumerrawat6947 2 жыл бұрын
Understood !
@harshdasila6680
@harshdasila6680 2 жыл бұрын
understoooddddd
@KUMARSAURABH-s5i
@KUMARSAURABH-s5i 5 ай бұрын
Understood Striver
@suryakiran2970
@suryakiran2970 Жыл бұрын
Understood❤
@saikrishna872
@saikrishna872 Жыл бұрын
UNDERSTOOD
@gurudekirtaniye9001
@gurudekirtaniye9001 Жыл бұрын
Understood but what the intuition ?
@kirtitung4877
@kirtitung4877 2 жыл бұрын
understood!!! JOD
@kulvindersingh5764
@kulvindersingh5764 21 күн бұрын
helpful!
@johar3737
@johar3737 2 жыл бұрын
Understood.
@ashishbhardwaj4334
@ashishbhardwaj4334 Жыл бұрын
Understood..
@UmeshYadav-qx4hr
@UmeshYadav-qx4hr 11 ай бұрын
link is not found for -C++/Java/Codes and Notes Link Please check.
@musixhunts32
@musixhunts32 4 күн бұрын
understood 🫡
@akshatpandey2609
@akshatpandey2609 2 жыл бұрын
can we pushback the node in ans in the postorder of the dfs function i.e., after the for-loop?
@rohit2571
@rohit2571 2 жыл бұрын
then you have to reverse the stack.
@sanadkhan1
@sanadkhan1 2 жыл бұрын
kzbin.info/www/bejne/bIfMZoealMZreJo&ab_channel=Pepcoding watch this for your doubt clarification
@arkasheikh3539
@arkasheikh3539 2 жыл бұрын
"UNDERSTOOD"
@akashsahu2571
@akashsahu2571 Жыл бұрын
yes
@rayyansyed2998
@rayyansyed2998 Жыл бұрын
"understood"
@supratimnayek2776
@supratimnayek2776 2 жыл бұрын
Understood
@chinmayregade2160
@chinmayregade2160 Жыл бұрын
Hey Striver ( @takUforward ) is topological sort used by dependency management tools like Maven or Gradle to manage project dependencies??
@namansharma8586
@namansharma8586 8 ай бұрын
Yes
@ayushgaurabh8604
@ayushgaurabh8604 5 ай бұрын
awesome
@bro_code3505
@bro_code3505 2 жыл бұрын
how do we know that stack will be used
@narendrarokkam5367
@narendrarokkam5367 2 жыл бұрын
Because we need to get in reverse order
@soumyamondal
@soumyamondal Жыл бұрын
@@narendrarokkam5367 we can store it in a vector then simply reverse it, space saved right?
@babai2196
@babai2196 Жыл бұрын
@@soumyamondal but time inc
@cypher7536
@cypher7536 2 жыл бұрын
understood ❤️
@GeneralistDev
@GeneralistDev Жыл бұрын
Stack is not necessary. We could have used a vector also
@priyanshkumar17
@priyanshkumar17 6 ай бұрын
but need to reverse the array
@felipesantiagogama2833
@felipesantiagogama2833 Жыл бұрын
understood.
@subhadeepghosh2813
@subhadeepghosh2813 2 жыл бұрын
maza aa gya
@harshmishra5331
@harshmishra5331 Жыл бұрын
Why can we not use simple array instead of stack. I am not able to understand of specific stack in this case. Can any body clear this?
@TheBillionairesWorld
@TheBillionairesWorld Жыл бұрын
Yes we can push into vector..... Than at the end we can reverse it
G-22. Kahn's Algorithm | Topological Sort Algorithm | BFS
13:50
take U forward
Рет қаралды 266 М.
G-20. Find Eventual Safe States - DFS
23:43
take U forward
Рет қаралды 180 М.
小路飞还不知道他把路飞给擦没有了 #路飞#海贼王
00:32
路飞与唐舞桐
Рет қаралды 88 МЛН
Real Man relocate to Remote Controlled Car 👨🏻➡️🚙🕹️ #builderc
00:24
ТЫ В ДЕТСТВЕ КОГДА ВЫПАЛ ЗУБ😂#shorts
00:59
BATEK_OFFICIAL
Рет қаралды 4,5 МЛН
Topological Sort Algorithm | Graph Theory
14:09
WilliamFiset
Рет қаралды 472 М.
AIR 6 vs AIR 600 after 6 years of graduating IIT
1:12:56
Harkirat Singh
Рет қаралды 27 М.
3 Types of Algorithms Every Programmer Needs to Know
13:12
ForrestKnight
Рет қаралды 500 М.
ML Was Hard Until I Learned These 5 Secrets!
13:11
Boris Meinardus
Рет қаралды 340 М.
G-27. Shortest Path in Directed Acyclic Graph - Topological Sort
26:36
take U forward
Рет қаралды 241 М.