You teach a topic and then you solve a question based on that topic. This is the best approach of teaching. Thanks
@techdose4u4 жыл бұрын
Welcome
@neghatnazir16684 жыл бұрын
@@techdose4u hey i am a bit confused would you pls clear it? if we start at node 4 the order comes out to b 5 3 0 4 1 2 which is not correct i guess? would pls explain this to me i am not getting it?
@willturner34404 жыл бұрын
@@neghatnazir1668 you are correct
@sreesayihrudai95413 жыл бұрын
@@neghatnazir1668 Try to run a loop from starting vertex to end vertex you will get the answer
@manishkumar-qn6lx2 жыл бұрын
@@techdose4u Even if there exists a loop, still there is the possibility to cover all the courses. Ex. [[0,1], [2,0], [2,1], [3,1], [3,2]]. ( [0, 1], indicates that to take course 0 you have to first take course 1 ) In the above example, there exists a loop but still, we can complete all the courses in the following order : [0,2,1,3].
@sainathy92254 жыл бұрын
@techdose, you are doing great job . I used to follow nich white and Kevin naughton . Now iam waiting for your videos. Keep doing!
@techdose4u4 жыл бұрын
Thanks :)
@bostonlights27494 жыл бұрын
Same for me as well
@vman0494 жыл бұрын
Same. @techdose completely dominates them!
@JayDonga4 жыл бұрын
Great video, thank you for clear explanation. One addition here, instead of doing double work (pushing elements to stack and popping every element to get answer), you can add each new element on front of LinkedList and then return the LinkedList.
@amith19894 жыл бұрын
Quick, crisp and clear!! Fantastic way of explaining Topological sorting in 13 minutes.!
@techdose4u4 жыл бұрын
Thanks
@greymatters227 ай бұрын
Thank you so much this channel, this channel focusses on solving all difficult problems based on advanced concepts. Love it
@harshbhadoria72003 жыл бұрын
The day before yesterday I came to youtube for a solution to a question, as usual, randomly I picked your video. I don't know what happened after that day, whenever I search for the question on youtube I'm writing Techdose at the end. Conclusion: The way you teach and make us understand every topic is too good.
@techdose4u3 жыл бұрын
Thanks 😊
@sohamshinde12583 жыл бұрын
Best in class channel with the best in class explanation. Thankyou so much.
@techdose4u3 жыл бұрын
Welcome :)
@harshithg54553 жыл бұрын
Super video! I applauded for ₹200.00 👏👏👏
@techdose4u3 жыл бұрын
Thanks for supporting ❤️
@harshithg54553 жыл бұрын
@@techdose4u Thank you for the remarkable videos 😀
@techdose4u3 жыл бұрын
Welcome :)
@sakshamgupta27403 жыл бұрын
graph videos are a real delight. Thanks for the content
@techdose4u3 жыл бұрын
Welcome:)
@rakeshsahni_4 жыл бұрын
This video Clear all my doubts regarding topological sort, thank you sir
@sharadmaheshwari53194 жыл бұрын
your explanations goes smoothly in my mind, thanks for help !
@techdose4u4 жыл бұрын
Welcome :)
@MarioFernandez-hx1cm2 жыл бұрын
in three hours ive got my last exam at my carrer as engeneer, and this helped a lot. Hopepefully ill aprove, thanks a lot
@shridharsarraf21883 жыл бұрын
This is best playlist on KZbin to learn Graphs ❤❤❤❤
@techdose4u3 жыл бұрын
Thanks ☺️
@shivammaniharsahu12284 жыл бұрын
really good one keep sharing such vedios
@joydeepbhattacharjee53053 жыл бұрын
one of the best channel for CS in youtube...thank u so much for such awesome contents... and keep helping us like this..
@techdose4u3 жыл бұрын
Sure. Thanks :)
@noobninja48824 жыл бұрын
perfect explanation sir, thanks a lot , following your graph series from the beginning , please continue this as i am learning a lot from this, and graph is my biggest fear
@techdose4u4 жыл бұрын
Okay sure.
@poojanshah93023 жыл бұрын
Very thorough explanation. I am always looking for your explanation before solving any Leetcode problem.
@techdose4u3 жыл бұрын
Great :)
@bostonlights27494 жыл бұрын
Quality content every time
@techdose4u4 жыл бұрын
😁
@fadiahetrakeshkumar94544 жыл бұрын
Nice video Best video for kahn algorithm
@techdose4u4 жыл бұрын
Thanks
@pepetikesavasiddhardha78522 жыл бұрын
awesome explination of topological sort algorithm
@amitavamozumder733 жыл бұрын
in 4:00 if I start from node 3, then the order will get messed up, right?
Such simple and elegant explanation can only be expected on TECH DOSE🍺
@techdose4u4 жыл бұрын
😁
@mwshubham3 жыл бұрын
How could something be such easy. Thanks 😊🙏
@techdose4u3 жыл бұрын
Welcome 😊
@kailashjangir15303 жыл бұрын
what if in starting we goes to node 3 rather than going to 2 in dfs, then answer would be changed na?
@FWTteam3 жыл бұрын
In search this was 3rd result, I'm glad I chose this.
@meghamalviya84954 жыл бұрын
Thank you for great explanation..your approach to explain problems is best!
@AmanGupta-ud6sy4 жыл бұрын
Amazing video.....best explanation.
@techdose4u4 жыл бұрын
Thanks
@agileprogramming74634 жыл бұрын
Wonderfully explained as always!
@techdose4u4 жыл бұрын
Thanks agile :)
@sheldon94154 жыл бұрын
Such a good and clear explanation ! Thank you for the time you put in making this awesome video!
@techdose4u4 жыл бұрын
Welcome :)
@iampatelajeet3 жыл бұрын
Amazing way of teaching bro, loved it.. Keep it up. Thanks!
@techdose4u3 жыл бұрын
Thanks ☺️
@galeforceonline38474 жыл бұрын
Thanks. its good that you explain the subject using pseudo code aswell.
@techdose4u4 жыл бұрын
Welcome
@pranjalgupta94274 жыл бұрын
Very nice explanation 👍👏😊
@techdose4u4 жыл бұрын
Thanks
@pcccmn Жыл бұрын
This approach is accepted by LC. Naturally because of the method `detectCycle`, the solution is beaten by many who got it done within 1 dfs method..But honestly, this solution should be taught first before attempting NeetCode's. This solution is way simpler to understand and implement!
@vidyakore39303 жыл бұрын
thanks a lott, explained so nicely... keep making such videos!!
@techdose4u3 жыл бұрын
Thanks
@electric3362 жыл бұрын
Very helpful video. You explained it very well.
@deepakjoshi4374 Жыл бұрын
I solved this Course Schedule I/II QS using the concept of Detect Cycle in a Graph (Using Colour Method). If there is a cycle you will not be able to complete the courses. else you can always take all the courses. For printing the courses, you can put into an array when you visited all its descendants.
@kunalsoni76814 жыл бұрын
😊😊😇😇☺️.. great video
@techdose4u4 жыл бұрын
Thanks
@shashanksinha69663 жыл бұрын
there is an extra recursive call to check cycle , we can do it using bfs in less time complexity
@techdose4u3 жыл бұрын
👍🏼
@jineshdave64513 жыл бұрын
Best explanation ✨✨
@techdose4u3 жыл бұрын
Thanks :)
@manmeetsingh42723 жыл бұрын
In the given example, from node 0 you first traversed to 2 then to 3 so the stack will be { 2, 1, 3, 0, ....} but if we traversed node 3 first before 2 then the stack will be { 1, 3, 2, 0, ....} as we see the stack is not in topological order. Because when we run our program in pc we don't know what node will be traversed first. Can you explain this case?
@shaziasamreen85844 жыл бұрын
Excellent Explanation..... Please upload leetcode daily challenge questions also..Your videos were very helpful..
@techdose4u4 жыл бұрын
Thanks :)
@AyushPandey04 жыл бұрын
Excellent explanation sir, keep uploading more videos on graph problem.
@techdose4u4 жыл бұрын
Thanks
@anmolwadali92274 жыл бұрын
gud explanation !! Plz Make videos on Minium spanning tree kruskal & prims algo
@techdose4u4 жыл бұрын
It will eventually come. Making videos topicwise in order.
@neerajpant40714 жыл бұрын
last few seconds was awesome it's more like listening to an terms and conditions for an insurance policy 🤣😄
@techdose4u4 жыл бұрын
😅 I just want to wrap the unnecessary talks quickly 😅
@neerajpant40714 жыл бұрын
@@techdose4u hehehe..correct Nice explanation. Always worth watching your videos.👍
@techdose4u4 жыл бұрын
Thanks.
@akm12374 жыл бұрын
Hello sir. Does it matter which edge we start with for the topological sort? Say we begin with 3, wouldn't 3 come before 2 in the stack?
@aparnamittal86533 жыл бұрын
No, it does not matter. 3 will come before 2 in stack but when we pop elements, it will result in coming at end in the order which is correct.
@anumonto4 жыл бұрын
simple and clear explanation.. Great!.
@techdose4u4 жыл бұрын
Thanks
@superneutral16632 жыл бұрын
brilliant explanations,love all your videos
@pranjalgupta94274 жыл бұрын
Can i also start from other vertex rather than 0?
@manishkumar-qn6lx2 жыл бұрын
@TECH DOSE Even if there exists a loop, still there is the possibility to cover all the courses. Ex. [[0,1], [2,0], [2,1], [3,1], [3,2]]. ( [0, 1], indicates that to take course 0 you have to first take course 1 ) In the above example, there exists a loop but still, we can complete all the courses in the following order : [0,2,1,3].
@techdose4u2 жыл бұрын
There is no cycle in your graph :)
@davngo4 жыл бұрын
Your explanations and solutions are so beautiful.
@techdose4u4 жыл бұрын
Thanks
@yihongliu38503 жыл бұрын
really nice and clear
@techdose4u3 жыл бұрын
Thanks Yihong :)
@rajatgarg68592 жыл бұрын
It was amazing ,thanks buddy :)
@thedisciplinedguy4 жыл бұрын
Doing a great work brother... Keep this spirit up... Your videos are really helpful.. 👌😊😊
@ayyappareddy44614 жыл бұрын
Super explaination sirr
@techdose4u4 жыл бұрын
Thanks
@willturner34404 жыл бұрын
Thanks sir for such a great explanation, genius 🥰
@techdose4u4 жыл бұрын
Welcome :)
@prasannakumarz4 жыл бұрын
very good explanation
@techdose4u4 жыл бұрын
Thanks
@mr_tpk3 жыл бұрын
Awesome 🔥🔥🔥
@josevalbuena94233 жыл бұрын
Why is the motivation to perform Khan’s algorithm/Topological Sort with a DFS approach to solve this problem while in the explanation of the topic is based of BFS? What’s the reason? Can both approaches be used to apply Topological sort?
@smartwork70985 ай бұрын
Great work, man!
@be_like__prateek4 жыл бұрын
U r just awesome 💕
@techdose4u4 жыл бұрын
Thanks :)
@nayanjain57613 жыл бұрын
In 1st video CS-I (Course schedule I) you created ajd by adj[i[0]].push_back(i[1]); i.e. 0->1 , and here inverse adj[i[1]].push_back(i[0]); 1->0. Also I checked for CS-I adj[i[1]].push_back(i[0]); is also passing, please explain. Thanks
@techdose4u3 жыл бұрын
If you are checking cycle then it doesn't matter how you take. It should be same for all the edges
@nayanjain57613 жыл бұрын
@@techdose4u Thanks for this quick response and and all amazing content.
@darshansimha21664 жыл бұрын
Amazing Explanation!
@techdose4u4 жыл бұрын
Thanks
@vishal400072 жыл бұрын
I didn't think of using the stack. What is the thought process for solving the problem? How did you come up with stack?
@shubhamagarwal29983 жыл бұрын
7:43 this is not 100% necessary that nodes with outgoing degree=0 is comes at last .... like if in this example 0->{2,3) dfs(0)->dfs(3)->dfs(1) o/p stack = [1,3 dfs(0)->dfs(2) o/p stack = [1,3,2
@vamsiKrishna964 жыл бұрын
Tech Dose, Awesome Explanation. Your reach would increase if you can share the solutions in java.
@techdose4u4 жыл бұрын
Yea...but I think people should focus on learning logic and implement themselves. Already codes are available in all languages.
Very well explained the logic :)) But I could not get one thing in the code--> How are we making adjacency list?? //Make adjacency list for(int i=0;i
@codebits21203 жыл бұрын
Thanks 😊
@techdose4u3 жыл бұрын
Welcome
@pranavsharma74794 жыл бұрын
thanks for your work
@techdose4u4 жыл бұрын
Welcome
@Learner0104 жыл бұрын
very nicely explained !!!
@techdose4u4 жыл бұрын
Thanks
@afnaanrafique3662 жыл бұрын
Why is simple BFS not a solution to this problem?
@gaurangmittal55634 жыл бұрын
Sir why did u used a graph coloring method for a detecting cycle in a directed graph, as in your vidoe you have used another approach.
@techdose4u4 жыл бұрын
Graph Coloring is simple and works in O(V+E) otherwise we will have to use stack.
@supratikk4 жыл бұрын
I have implemented the same algo but just used the cycle detection method shown by you in the "course schedule1" problem. But its giving me a time Limit Exceeding error. Is that the reason why you slightly tweaked the cycle detention method in this problem?
@techdose4u4 жыл бұрын
I don't exactly remember the reason 😅
@rahulchudasama93634 жыл бұрын
Awesome explaination, One suggestion Topological sort explaination video should come before the Reconstruct Itinerary video. So that flow can be maintained.
@techdose4u4 жыл бұрын
Okay i will reorder. Thanks for letting us know.
@tech_wizard93154 жыл бұрын
1) m a fresher, working in IT company of Jodhpur(9 hours job). If I prep DSA with c++ , 3-4 hrs each day for 3 months(leetcode) , can I gt job at Google,FB, Apple ? If not, then hw much time/months need? 2) If.i have one project in my resume, is it enuf for project round of FAANG
@techdose4u4 жыл бұрын
You can crack job at AMAZON , Microsoft with this preparation but Google and apple requires you to distinguish yourself from the rest. Your resume should show what sets you apart from the rest. This prep is done by thousands of jobseekers and hence you need either an exceptional coding profile or an exceptional dev profile or both in a balanced way.
@tech_wizard93154 жыл бұрын
@@techdose4u is one project enuf?
@ManojKumar-so9kw4 жыл бұрын
@@tech_wizard9315 nope man it wont be enough at any day for any of the product based companies
@techdose4u4 жыл бұрын
@@tech_wizard9315 one project is enough but it depends on what work you had done, the complexity and level of responsibility you were handling and the amount of effort you put. This defines your character as an SDE. Don't worry if you have 1 project, but the important thing is your dedication alongwith complexity and level of ownership of your project.
@exodus59484 жыл бұрын
Bro , I am in a same situation 2020 batch and more from electronics batch from a tier 3 college, But I suggest you must make 2-3 Projects, OtherWise interviewer is definitely going to grill a lot. Best of luck for your preparations.
@learnfromramayan81764 жыл бұрын
sir why cant we push the processed node and return answer following the exact method you taught in course schedule i. when we make a course processed=1 at that time why cant we push and add to result? Thank you in advance
@ShubhamKumar-zy7wy4 жыл бұрын
Bhagwan hai bhai ye
@techdose4u4 жыл бұрын
😅
@kiranathavanad80502 жыл бұрын
good one
@Cat-uk2jx2 жыл бұрын
Hello! I was doing this exercise I started with 4to 2 then I went to 4to 1. I then restarted at 5 to 0 to 3 and I got the following result 5,0,3,4,1,2. Is this correct? I read that one can start with any node (not just 5 or 4). Also I saw another comment with I different topological ordering which I also got 5,0,3,4,2,1. Can anyone explain why these are wrong? I am a beginner and I am having some difficulty grasping this concept. Thank you!
@ashishg6564 жыл бұрын
Great content :)
@swagatpatra21394 жыл бұрын
What about loops in the schedule? We need to return an empty array in that case.
@arindamchakraborty58802 жыл бұрын
@TECH DOSE I am having one doubt, Can we write 0 before 4 in the top sort? like 5, 0, 4 likewise? Please clarify.
@i_mchick53113 жыл бұрын
Hello sir ! can u also share the notes that u write while teaching ??
@AmarKumar-vo2bv4 жыл бұрын
Please make video on finding articulation point
@techdose4u4 жыл бұрын
It will come in connectivity topic. I am covering topicwise. Have patience.
@ameynaik27433 жыл бұрын
Nice video. How did you find cycles in the graph?
@Sportamrina3 жыл бұрын
watch the course schedule video - it checks for cycles in the graph
@thiyagarajanr2254 жыл бұрын
Content at its best! How much hours did you spend in making the videos bro? Efforts behind the scenes matters a lot! Usually i dont comment in any videos, but i used to comment to value your efforts 💖
@taskmaster48243 жыл бұрын
buddy it is showing TLE in graph coloring ??
@vinitraj62684 жыл бұрын
At 4:29 you started from node 0.....but I think we can start from any node....
@exodus59484 жыл бұрын
I think within few months you are going to join google. :D, Loved your intuition behind problems. Please also make videos on Greed Approach
@techdose4u4 жыл бұрын
After graphs I am planning on doing DP + GREEDY mixed :)
@iSumitYadav4 жыл бұрын
TopoSort and Cycle finding can be combined to a single function only
@techdose4u4 жыл бұрын
I separated to provide code for topological sort.
@iSumitYadav4 жыл бұрын
@@techdose4u oh okay...👍🏻
@gontlakowshik23454 жыл бұрын
Sir, can you explain how find cycle in a graph
@spetsnaz_24 жыл бұрын
Already explained for directed and undirected graph... Check his Graph playlist
@cristianandrei8113 жыл бұрын
great video
@mohammadshafihamidi17782 жыл бұрын
if its possible i need some application of topological sort in field of providing accessibility in organic areas
ı think this is wrong because 2 has 3 indegree inputs (not 2 indegrees). that's why when we delete the 4 and 5 , it has also 0 indegree input. so it should be 4 possible results : " 4 - 5 - 0 - 2 - 3 - 1" or " 4 - 5 - 0 - 3 - 2 - 1" / " 5 - 4 - 0 - 2 - 3 - 1" or " 5 - 4 - 0 - 3 - 2 - 1"
@pradnyabapat95312 жыл бұрын
Thank you!!
@abhishekkumardwivedi38174 жыл бұрын
sir, please try to add a video for egg dropping puzzle if possible
@lokeshpatel39144 жыл бұрын
what if we get more than one components in graph and 1 component forms DAG and other does not ?
@AjayKumar-un2fz4 жыл бұрын
Simply , we can't do topological sort because one of component is not DAG . We will got stuck in cycle while selecting courses for that component.
@lokeshpatel39144 жыл бұрын
@@AjayKumar-un2fz But in such case an empty array can't be returned as output coz there must be some courses we can take as valid courses which forms different component .