God !!!!! you just spoke my mind........ even i am 20 and literally i am hell scared of all backtracking questions ......... infact i have skipped all of them ........ hell
Erik Demaine is amazing. His lectures are so fun to watch and easy to follow. I love his older lectures too but mannn his more recent ones are pure gold.
Erik: When I was 7 year old, one of the first computer program I wrote was for solving a maze. .... Me: When I was 7 years old, I fast and furious with my new bicycle and ended up with stitches...(that's as impressive as I can get for a 7 years old me)
03:55 Have been sitting scratching my head the whole semester over graphs and algorithms and he drops this bomb on me 1 week before my exam. Thank you for the confidence boost mate.............................................................. (jk he is awesome :) )
Thank u for this amazing lecture my algo professors need to learn from u both way to teach and also get some knowledge as they are absolutely terrible.
well i had my first c++ program written at age 25. Left that 10 yrs for other studies but still manage to work as a c++ developer during a postdoc fellowship. I don't think age matters but time management is a headache.
Edit: he later corrected himself. Introduction to Algorithms (3rd edition) by T. Cormen says "We now show that forward and cross edges never occur in a depth-first search of an undirected graph". Then why did the professor say we have cross edges in an undirected graph?
No people, that's legit he did that in 7. This guy was one of the child prodigies and he is famous for it. He got his PhD at the age of 20. What really surprised me was he said I have a terrible memory which is something that I would think every genius like him would have.
28:13 but what if we don't follow that first edge? well then we follow the second one. using your logic, that first "tree" edge is actually a "back" edge! i think that these edges are just a by-product of dfs and not for generic graphs without using dfs, if that makes sense. cheers :D
This is a good lecture, but I think would be confusing for people that aren't already familiar with how a DFS works, which is simpler than it seems here. What I like about it is the how he shows the pseudocode for it and the reasoning behind that.
the difference between a avg teacher and a great one is how do you communicate when students mistake. For ex: what is the time complexity? some said 'V'. He said ' A little optimistic' !! WOW !!
Most teachers are egomeniac as my observation of their characters; they enjoy tearing down students' confidence with out providing much comprehendable explanations(most of the times). The best teachers don't thems self that seriously and tend to build students knowledge base and confidence at the same time.
Parent dictionary has been declared in both function is it a global variable ? or the parent's function are different? because in DFS parents contain start vertex while in the seconde one it contains father of.. with only one source.
You can start your search earlier, then go over v1 to vk, before you hit v1 again. That is meant with "the first vertex that is hit by the DFS", basically, the first time you do DFS on a node that has already been visited before by that same search.
Doesn't a discussion of topological sort need to include mention of a tie-breaker function, and a discussion of whether the tie breaker guarantees a unique order which obeys the constraints? It seems to me, naively, that the DFS approach is insufficient with certain tie-breaker functions. It is a bit strange that both the lecturer and also Cormen [Intro to Algorithms, Thomas Cormen et.al] ignore the question of a deterministic topological sort. My first encounter with topological sort with with the linerarization of class precedence lists in object systems which allow multiple inheritance. It is of utmost importance that the the class precedence list be deterministically ordered.
The textbook for the course is Cormen, Thomas, Charles Leiserson, Ronald Rivest, and Clifford Stein. Introduction to Algorithms. 3rd ed. MIT Press, 2009. ISBN: 9780262033848. See the course on MIT OpenCourseWare for more info and materials (lectures notes, exams with solutions, assignments with solutions) at ocw.mit.edu/6-006F11. Best wishes on your studies!
in DFS node goes from A to B and A to C Doesn't make B and c siblings?? When explaining types of edges @21:00 If node d is traversed first then node b and then node e and then node g when you draw an edge between G and C how it make crossed egde?? It should be backward and .. Cross edge should be like edge from F to itself.. ???
Linkon Manwani How does it go from A to C? if there was a line connecting them then it would be a cross edge and yes as sub tree they would be siblings.
What if the first node you visit in DFS is some node in the middle and can never reach its parent? wouldn't its parent be set to none and never corrects?
Isn't determing back edges for right and left just a matter of perspective? I don't really understand how the two algorithms for left and right back edges differ..
Hey I had a simple doubt, won't we visit every vertex twice in DFS algo, once in for loop of top layer part of DFS algo and once in DFS-visit part of the algo ? Is that what he explained us at 13:50 ? So can I say that runtime complexity will be O(2V + E) which is equivalent to O(V + E) because 2V is equivalent to V as both are linear !
To further beat a dead horse, the discussion of forward/cross/backward edges is a bit confusing, and not exactly well defined. Perhaps it is better defined in the text book the lecturer keeps referring to. For example, there is a looping edge from f to f. If you mark nodes in lineage list using the method explained in the lecture (via started-examining finished-examining advise), then the loop edge will point to a parent node (by that algorithm), and thus be a backward edge. Is this the intent?
Zuckerberg was a psychology major who's considered a tech genius because he wrote an app that sold well. All it was at the time was a few hundred lines of PHP. Erik is on another level.
After visiting "a,b,c,d" how can we directly go to "c" (and mark as "s2"). What I didn't understand is how can we iterate throught next node in same level without having any implementation?
+Adi TheOrigin there is a list of graph vertices in V [a,b,c,...] once you are done with everything around a, your try b: since it is already seen , move to c (reached s2). This can be done via a for loop!
it was kind of random that the professor chose c to go to next. It is not guaranteed that the next node is always in the "same level"; the next node, s2, could have been any of the graph nodes. The for loop, "for s in V", and the order that you have placed the nodes in V decides what node you visit next.
Hello, everyone. I have a question about forward edge. The lecturer said that a forward edge is a node->descendant, but, imho it shouldn't be tree edge of the ancestor. So, if we write an edge from b to g - that one will be a forward. Am I right? Thanks for responses.
The textbook is Cormen, Thomas, Charles Leiserson, Ronald Rivest, and Clifford Stein. Introduction to Algorithms. 3rd ed. MIT Press, 2009. ISBN: 9780262033848. You can find more course information and materials (lecture notes, assignments, exams) on MIT OpenCourseWare: ocw.mit.edu/6-006F11
I was never able to learn like this. How is it possible to take notes AND simultaneously learn a new complex topic? The time complexity of this teaching method is like O(n!). You literally have to wait until the professor reads his notes and writes it on the board before you can then read it and write it in your notebook, only to then have to read it again later because you were too busy taking notes to learn it. There's so much more I can say, but I'll leave it at that. I'm only here to remind myself of how useless lectures were for me. I learned by reading the textbook.
The required textbook listed in the syllabus is: Cormen, Thomas, Charles Leiserson, Ronald Rivest, and Clifford Stein. Introduction to Algorithms. 3rd ed. MIT Press, 2009. ISBN: 9780262033848. For more info and course materials (assignments, readings, exams), see the course on MIT OpenCourseWare at ocw.mit.edu/6-006F11.
The student are so coooool when the teacher want democratic math, the total number of hands-up doesn't exceed 10..... Really similar as my student age, most students are sleep when taken algorithm course.
"when I was 7 years old I did DFS without even knowing it"and here i am 20 yo banging my head against wall to understand topic
me too bro, me too
God !!!!! you just spoke my mind........ even i am 20 and literally i am hell scared of all backtracking questions ......... infact i have skipped all of them ........ hell
I didn't know DFS when I was 7 but I did know BFS subconsciously. I used it to get home after riding all over town on my bicycle all day.
DFS might be a bit more handy in your case lmao.
😂😂😂
I love this comment
no how can u use bfs?u went to block a,then street 1, 2, 3 of block a, failed. Then you move to block b. Right?
Topological Sort: 42:00
Wow I was smiling in my mind when this happened - 26:36
So much so for being a student of MIT.
.
.
Sorry for bad english .
thank you , you're the best
Erik is one of my favorite professors of all time
Erik Demaine is amazing. His lectures are so fun to watch and easy to follow. I love his older lectures too but mannn his more recent ones are pure gold.
Any specific ones?
02:05 depth-first search
08:58 example
14:11 running time
18:03 edge classification
30:40 cycle detection
41:57 topological sort (job scheduling)
This has to be one of the best lecture in the series.
These lectures are so easy to follow. Thanks alot MIT
"when I was 7 years old I did DFS without even knowing it" weird flex but ok
flex is real xD
Yeah. I agree. But he is a prof at MIT and we are potatoes watching him teaching.
@@rj-nj3uk Well, I'm a tomato!
3:54
i lol'ed at his comment
DFS Time Complexity: 14:10
Cycle Detection: 30:00
Topological Sort: 42:00
when he was 7 years old he wrote a program to solve a maze using dfs, and that too without knowing it was dfs.WOW!!!.
+ron thomas He is the youngest prof in the history of MIT. He made a prof at around 20. Check out his wiki page :D
+Spandan Madan That is friggin awesome. He has a geeky charisma about him as well.
+Spandan Madan bruh
He should be like one of the guys in big bang theory. The only difference is he is a real person.
f
It'd be really cool, if people who attended this class like 10 year ago would come here to see this video :D
Superb teacher...................Wish if all colleges students can see these videos and learn better!!!!
Manish M Berwani They can. :)
I have seen many colleges, where students never learn from internet!
Cycle Detection: 30:00
Topological sort: 42:00
Oh Lord, one of the brightest minds at MIT is saying that doesn't have a good memory, that's the only part of the lecture I didn't understand
he is a math genius. math doesn't need much memory. It needs intuition and logic.
This man is truly amazing. Would be kinda interesting to see the textbooks MIT uses
Ikaros97 According to the course website, CLRS is the textbook for this course
@@nathanaelfarciert711 Kinda funny because i use the same ^^ Its like everybody uses it but quite often its very mathematical and hard to understand
*IMDB Rating* : 10/10 for this whole 6006 series
edit : + extra 100points for uploading the crispy notes
I was playing with mud when I was 7 years old
I was eating mud when I was 7 years old
I wish I was bold enough to wear a pony tail, a t-shirt, and jeans to teach class lectures. I love this man.
7 years old im trying to learn to read my native language and this man already master computer language
Edge Classification 18:22
Erik: When I was 7 year old, one of the first computer program I wrote was for solving a maze.
....
Me: When I was 7 years old, I fast and furious with my new bicycle and ended up with stitches...(that's as impressive as I can get for a 7 years old me)
damn bruh shouts out to young demaine killing the algorithm game since a young'n!
03:55 Have been sitting scratching my head the whole semester over graphs and algorithms and he drops this bomb on me 1 week before my exam. Thank you for the confidence boost mate.............................................................. (jk he is awesome :) )
30:10 - after explaining tree / backward/forward edges - "So what?". Exactly what I was wondering
Thank You MIT.
Thank u for this amazing lecture my algo professors need to learn from u both way to teach and also get some knowledge as they are absolutely terrible.
Breadcrumb analogy was perfect
topological sort 42:00
Wish I knew DFS when I was seven...
well i had my first c++ program written at age 25. Left that 10 yrs for other studies but still manage to work as a c++ developer during a postdoc fellowship. I don't think age matters but time management is a headache.
Edit: he later corrected himself. Introduction to Algorithms (3rd edition) by T. Cormen says "We now show that forward and cross edges never occur in a depth-first search of an undirected graph". Then why did the professor say we have cross edges in an undirected graph?
What?
thank you from DePaul, MIT
14:12 DFS time complexity
O(V+E)
No people, that's legit he did that in 7. This guy was one of the child prodigies and he is famous for it. He got his PhD at the age of 20. What really surprised me was he said I have a terrible memory which is something that I would think every genius like him would have.
that tells he has high expectation of himself
In the 2005 course there was Leiserson talking shit about python.
Now: "this is python notation"
I love Erik Demaine!
Erik Demaine is hot! He makes any lecture 100 times more interesting!!
28:13 but what if we don't follow that first edge? well then we follow the second one. using your logic, that first "tree" edge is actually a "back" edge! i think that these edges are just a by-product of dfs and not for generic graphs without using dfs, if that makes sense. cheers :D
This is a good lecture, but I think would be confusing for people that aren't already familiar with how a DFS works, which is simpler than it seems here. What I like about it is the how he shows the pseudocode for it and the reasoning behind that.
the difference between a avg teacher and a great one is how do you communicate when students mistake. For ex: what is the time complexity? some said 'V'. He said ' A little optimistic' !! WOW !!
Most teachers are egomeniac as my observation of their characters; they enjoy tearing down students' confidence with out providing much comprehendable explanations(most of the times).
The best teachers don't thems self that seriously and tend to build students knowledge base and confidence at the same time.
Seems like the camera man is asleep half of the time but great lecture!
Parent dictionary has been declared in both function is it a global variable ? or the parent's function are different? because in DFS parents contain start vertex while in the seconde one it contains father of.. with only one source.
36:06 - what is the difference between "where we start the search" and "the first vertex that is hit by the DFS?" thanks!
You can start your search earlier, then go over v1 to vk, before you hit v1 again. That is meant with "the first vertex that is hit by the DFS", basically, the first time you do DFS on a node that has already been visited before by that same search.
12:20 D is a parent to nothing,so it is'nt in the parent [ ].So how do we know that it's already been visited?
Doesn't a discussion of topological sort need to include mention of a tie-breaker function, and a discussion of whether the tie breaker guarantees a unique order which obeys the constraints? It seems to me, naively, that the DFS approach is insufficient with certain tie-breaker functions. It is a bit strange that both the lecturer and also Cormen [Intro to Algorithms, Thomas Cormen et.al] ignore the question of a deterministic topological sort. My first encounter with topological sort with with the linerarization of class precedence lists in object systems which allow multiple inheritance. It is of utmost importance that the the class precedence list be deterministically ordered.
14:18 - Rundown of DFS (Figure 22.4) on pg. 605
Check the parent and if it not visited, traverse recursively
@ 28:35 why would we follow the edge from the 2nd node from ''S' back to 'S' in case of undirected graph?
In the graph shouldn't the arrow drawn on the edge be from B to D?
Is it OK to use recursive DFS for topological sort in practice? Or should we use a iterative implementation to avoid possible stack overflows?
I didn't know you could be extremely clever and didactic at the same time. Congratulations.
adios
He mentioned a book. what book is that ? @MIT openCourseWare
The textbook for the course is Cormen, Thomas, Charles Leiserson, Ronald Rivest, and Clifford Stein. Introduction to Algorithms. 3rd ed. MIT Press, 2009. ISBN: 9780262033848. See the course on MIT OpenCourseWare for more info and materials (lectures notes, exams with solutions, assignments with solutions) at ocw.mit.edu/6-006F11. Best wishes on your studies!
haha i was doodling on the maze when i was 7 years old
in DFS node goes from A to B and A to C
Doesn't make B and c siblings??
When explaining types of edges @21:00
If node d is traversed first then node b and then node e and then node g when you draw an edge between G and C how it make crossed egde??
It should be backward and ..
Cross edge should be like edge from F to itself.. ???
Linkon Manwani How does it go from A to C? if there was a line connecting them then it would be a cross edge and yes as sub tree they would be siblings.
What the use of Visit(V, Adj s) at 13:36 ?
8:30 in the parameters for DFS, are those commas between| V and Adj or are they little n's?
Commas. He does kind of backwards commas
14:53 "collaborative effort" LOL
When I was 7, I knew how to backtrack and how to write.
What if the first node you visit in DFS is some node in the middle and can never reach its parent? wouldn't its parent be set to none and never corrects?
Thank you so much, it was very easy to understand!
Professor Erik Demaine solved DFS when he was 7.... Dang.
thanks for that,.......now m clear about the concept behind that...
46:20. why ? who knows? , Let's prove it.
Isn't determing back edges for right and left just a matter of perspective? I don't really understand how the two algorithms for left and right back edges differ..
Hey I had a simple doubt, won't we visit every vertex twice in DFS algo, once in for loop of top layer part of DFS algo and once in DFS-visit part of the algo ?
Is that what he explained us at 13:50 ?
So can I say that runtime complexity will be O(2V + E) which is equivalent to O(V + E) because 2V is equivalent to V as both are linear !
yessir we drop the 2 because 2v and v have the same asymptotic complexity
God alone knows man's heart his thoughts we can only go by what we see or hear. Compation is rear commodity in world more rare gold.
How would I choose the starting node?
To further beat a dead horse, the discussion of forward/cross/backward edges is a bit confusing, and not exactly well defined. Perhaps it is better defined in the text book the lecturer keeps referring to. For example, there is a looping edge from f to f. If you mark nodes in lineage list using the method explained in the lecture (via started-examining finished-examining advise), then the loop edge will point to a parent node (by that algorithm), and thus be a backward edge. Is this the intent?
Why does he uses paper? He does not keep in the head these ideas?
yeah but do you have a dfs on rs mate
28:34 can anyone explain it?
Don't forget he is doing DFS, in DFS of his version, it will always follow the edge as long as there is a possible way.
Thanks MIT
where is lip gallagher
I need help,
I want to sort in bash file,
Example....
a="10"
b="100"
C="1000"
I want to sort this
$a $b $c
How to sort ?? Max value between this
3:15 theoddone
why do we need V as an argument in DFS-Visit method ?
It's the set of vertices.
In case someone else has the same question, he said at 5:18 that the V doesnt have to be there in the argument and the students can erase it.
when I was 7 years old I did DFS without even knowing it" . Ok Its not too late for learning new things (Me at 29 and appease myself)
He knew a smattering of DFS when he was 7 years old. Morale: Not all precocious geeks end up like Mark Zuckerberg.
mark zuckerberg is a complete noob compared to erik
Zuckerberg was a psychology major who's considered a tech genius because he wrote an app that sold well. All it was at the time was a few hundred lines of PHP. Erik is on another level.
This guy is so cool! \m/
Does this lecture have DAGs?
After visiting "a,b,c,d" how can we directly go to "c" (and mark as "s2"). What I didn't understand is how can we iterate throught next node in same level without having any implementation?
+Adi TheOrigin there is a list of graph vertices in V [a,b,c,...]
once you are done with everything around a, your try b: since it is already seen , move to c (reached s2). This can be done via a for loop!
it was kind of random that the professor chose c to go to next. It is not guaranteed that the next node is always in the "same level"; the next node, s2, could have been any of the graph nodes. The for loop, "for s in V", and the order that you have placed the nodes in V decides what node you visit next.
what is the text book followed?
that's Erik ma boy
ayo my boi are you ok its been 7 years how life goin?
which text does he follow , i wonder???
CLRS is the textbook for the course, you can easily find it online.
We don't pay, but we get!
The parent map has to be global or pass down to recursive calls. Otherwise, it won't work.
Humm my code was right as it was changing it's level and back level for each isolated components or for each non out degree vertices
Hello, everyone. I have a question about forward edge. The lecturer said that a forward edge is a node->descendant, but, imho it shouldn't be tree edge of the ancestor. So, if we write an edge from b to g - that one will be a forward. Am I right? Thanks for responses.
descendant word applies only when node is a tree edge of that ancestor
whats the criteria for MS in MIT for international students :)
Have you found it out in 5 years ?
Hello tell me what you found.
Hey ajeet . I am pooja. Did you found anything in 7 years ?
i think text book u have is cormen lieserson
He keeps revering to the textbook, what is the title of the texbook and author
The textbook is Cormen, Thomas, Charles Leiserson, Ronald Rivest, and Clifford Stein. Introduction to Algorithms. 3rd ed. MIT Press, 2009. ISBN: 9780262033848. You can find more course information and materials (lecture notes, assignments, exams) on MIT OpenCourseWare: ocw.mit.edu/6-006F11
+Deon Thomas usually known as CLRS.
Great thanks ;-)
CLRS. Google it and you'll find the book
I also played with trees at 7... real trees, like the wooden kind.
💀
i want a cushion, too.....
I was never able to learn like this.
How is it possible to take notes AND simultaneously learn a new complex topic?
The time complexity of this teaching method is like O(n!).
You literally have to wait until the professor reads his notes and writes it on the board before you can then read it and write it in your notebook, only to then have to read it again later because you were too busy taking notes to learn it.
There's so much more I can say, but I'll leave it at that.
I'm only here to remind myself of how useless lectures were for me. I learned by reading the textbook.
Big YELLOW chalks prints White!
That is yellow wrapper around white chalk i guess, to avoid sticking.
That is the plastic chalk holder so the hands of the professor do not get dirty
I don't know how to thank you.. just thanks
Well explained!, Thanks.
what exactly is the textbook they use????????
The required textbook listed in the syllabus is: Cormen, Thomas, Charles Leiserson, Ronald Rivest, and Clifford Stein. Introduction to Algorithms. 3rd ed. MIT Press, 2009. ISBN: 9780262033848. For more info and course materials (assignments, readings, exams), see the course on MIT OpenCourseWare at ocw.mit.edu/6-006F11.
when i was 7 years old i wrote hello world without even knowing it was hello world
The student are so coooool when the teacher want democratic math, the total number of hands-up doesn't exceed 10..... Really similar as my student age, most students are sleep when taken algorithm course.