MIT 6.006 Introduction to Algorithms, Fall 2011 View the complete course: ocw.mit.edu/6-0... Instructor: Erik Demaine License: Creative Commons BY-NC-SA More information at ocw.mit.edu/terms More courses at ocw.mit.edu
Пікірлер: 213
@neuron81863 жыл бұрын
"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
@ronitaryan54023 жыл бұрын
me too bro, me too
@perveenneha14233 жыл бұрын
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
@MichaelBrashier8 жыл бұрын
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.
@ervinzhou82517 жыл бұрын
DFS might be a bit more handy in your case lmao.
@Maen9634 жыл бұрын
😂😂😂
@zaramomadi55693 жыл бұрын
I love this comment
@hkjpotato3 жыл бұрын
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?
@saifabu17447 жыл бұрын
Erik is one of my favorite professors of all time
@excalibour0011 жыл бұрын
Topological Sort: 42:00
@cloveramv6 жыл бұрын
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 .
@mrodriguezglobe3 жыл бұрын
thank you , you're the best
@sergeykholkhunov18883 жыл бұрын
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)
@zulumopuku53704 жыл бұрын
These lectures are so easy to follow. Thanks alot MIT
@SanghoBose56 жыл бұрын
This has to be one of the best lecture in the series.
@ronthomas83319 жыл бұрын
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!!!.
@spandanhetfield8 жыл бұрын
+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
@ChrisLeeX8 жыл бұрын
+Spandan Madan That is friggin awesome. He has a geeky charisma about him as well.
@abaybektursun8 жыл бұрын
+Spandan Madan bruh
@jackll21498 жыл бұрын
He should be like one of the guys in big bang theory. The only difference is he is a real person.
@hanssarpei54298 жыл бұрын
f
@mrodriguezglobe3 жыл бұрын
DFS Time Complexity: 14:10 Cycle Detection: 30:00 Topological Sort: 42:00
@zaramomadi55693 жыл бұрын
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.
@booleangray22253 жыл бұрын
Any specific ones?
@siennahunter90435 жыл бұрын
"when I was 7 years old I did DFS without even knowing it" weird flex but ok
@doom96034 жыл бұрын
flex is real xD
@rj-nj3uk4 жыл бұрын
Yeah. I agree. But he is a prof at MIT and we are potatoes watching him teaching.
@BharCode094 жыл бұрын
@@rj-nj3uk Well, I'm a tomato!
@bartekpacia4 жыл бұрын
3:54
@grantfaith4 жыл бұрын
i lol'ed at his comment
@estebanlopez17014 жыл бұрын
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
@crjacinro4 жыл бұрын
he is a math genius. math doesn't need much memory. It needs intuition and logic.
@mohitnirwan98124 жыл бұрын
It'd be really cool, if people who attended this class like 10 year ago would come here to see this video :D
@manishmberwani45410 жыл бұрын
Superb teacher...................Wish if all colleges students can see these videos and learn better!!!!
@JeewanthaBandara9 жыл бұрын
Manish M Berwani They can. :)
@manishmberwani4549 жыл бұрын
I have seen many colleges, where students never learn from internet!
@BikasKatwalK4 жыл бұрын
Cycle Detection: 30:00 Topological sort: 42:00
@dragon_warrior_3 жыл бұрын
*IMDB Rating* : 10/10 for this whole 6006 series edit : + extra 100points for uploading the crispy notes
@ikaros97274 жыл бұрын
This man is truly amazing. Would be kinda interesting to see the textbooks MIT uses
@nathanaelfarciert7114 жыл бұрын
Ikaros97 According to the course website, CLRS is the textbook for this course
@ikaros97274 жыл бұрын
@@nathanaelfarciert711 Kinda funny because i use the same ^^ Its like everybody uses it but quite often its very mathematical and hard to understand
@Victor-yn6jm4 жыл бұрын
I was playing with mud when I was 7 years old
@sulakshanachakraborty12383 жыл бұрын
I was eating mud when I was 7 years old
@HexagonalClosePacked4 жыл бұрын
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)
@MikeChaseJr4 жыл бұрын
I wish I was bold enough to wear a pony tail, a t-shirt, and jeans to teach class lectures. I love this man.
@mindlessripoff2210 жыл бұрын
damn bruh shouts out to young demaine killing the algorithm game since a young'n!
@essamewaisha87466 жыл бұрын
Edge Classification 18:22
@nonsolomacintosh6 жыл бұрын
In the 2005 course there was Leiserson talking shit about python. Now: "this is python notation"
@lockersrandom61614 жыл бұрын
Thank You MIT.
@gamingdork36813 жыл бұрын
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.
@brandoncruz120811 жыл бұрын
Wish I knew DFS when I was seven...
@jdleanne4 жыл бұрын
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.
@cesaredecal22304 жыл бұрын
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?
@Chatbot1212 жыл бұрын
Breadcrumb analogy was perfect
@lambo27122 жыл бұрын
7 years old im trying to learn to read my native language and this man already master computer language
@dakotadanderson5 жыл бұрын
thank you from DePaul, MIT
@saadabouzahir86967 жыл бұрын
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.
@souvikdas27595 жыл бұрын
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 !!
@mearaftadewos85082 жыл бұрын
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.
@Augustinephillips11 жыл бұрын
I love Erik Demaine!
@jimnewton45345 жыл бұрын
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.
@mehmetatabal69234 жыл бұрын
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.
@mearaftadewos85082 жыл бұрын
that tells he has high expectation of himself
@quidquopro11856 жыл бұрын
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 :) )
@ShingHim6 жыл бұрын
Seems like the camera man is asleep half of the time but great lecture!
@sudhanshudey7583 жыл бұрын
In the graph shouldn't the arrow drawn on the edge be from B to D?
@jasonavina81352 жыл бұрын
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.
@4blossoms10 жыл бұрын
Erik Demaine is hot! He makes any lecture 100 times more interesting!!
@w1d3r754 жыл бұрын
Check the parent and if it not visited, traverse recursively
@andreibozantan8 ай бұрын
Is it OK to use recursive DFS for topological sort in practice? Or should we use a iterative implementation to avoid possible stack overflows?
@TomerBenDavid5 жыл бұрын
topological sort 42:00
@MrSmokey2473 жыл бұрын
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..
@sicktastictv2 жыл бұрын
Professor Erik Demaine solved DFS when he was 7.... Dang.
@isabellehu92313 жыл бұрын
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
@JonLee1084 жыл бұрын
36:06 - what is the difference between "where we start the search" and "the first vertex that is hit by the DFS?" thanks!
@zeronothinghere93344 жыл бұрын
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.
@awesomefox46537 жыл бұрын
14:12 DFS time complexity
@evanshareef23974 жыл бұрын
O(V+E)
@stretch83906 ай бұрын
Does this lecture have DAGs?
@jimnewton45345 жыл бұрын
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?
@ankursatya47337 жыл бұрын
@ 28:35 why would we follow the edge from the 2nd node from ''S' back to 'S' in case of undirected graph?
@bogdantodasca20934 жыл бұрын
30:10 - after explaining tree / backward/forward edges - "So what?". Exactly what I was wondering
@HienNguyenTechIO4 жыл бұрын
Thanks MIT
@csl13843 жыл бұрын
14:53 "collaborative effort" LOL
@nanwu44306 жыл бұрын
The parent map has to be global or pass down to recursive calls. Otherwise, it won't work.
@yuf23165 жыл бұрын
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?
@thejassai85927 жыл бұрын
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?
@PratikShende9110 жыл бұрын
thanks for that,.......now m clear about the concept behind that...
@hbaduk7 жыл бұрын
where is lip gallagher
@randy44432 жыл бұрын
How would I choose the starting node?
@salexkorsan87903 жыл бұрын
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
@FantomX9325 ай бұрын
Why does he uses paper? He does not keep in the head these ideas?
@이효건-o4o3 жыл бұрын
haha i was doodling on the maze when i was 7 years old
@samhitajoshi4 жыл бұрын
When I was 7, I knew how to backtrack and how to write.
@joeyalfaro23233 жыл бұрын
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.
@NytronX6 жыл бұрын
14:18 - Rundown of DFS (Figure 22.4) on pg. 605
@TothAndris9110 жыл бұрын
Thank you so much, it was very easy to understand!
@zulumopuku53704 жыл бұрын
He mentioned a book. what book is that ? @MIT openCourseWare
@mitocw4 жыл бұрын
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!
@eightball80087 жыл бұрын
8:30 in the parameters for DFS, are those commas between| V and Adj or are they little n's?
@macdondb4 жыл бұрын
Commas. He does kind of backwards commas
@arvindkumar5314 жыл бұрын
What the use of Visit(V, Adj s) at 13:36 ?
@md.dilshadulislam91135 жыл бұрын
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
@capetaquebratudo6 жыл бұрын
I didn't know you could be extremely clever and didactic at the same time. Congratulations.
@dragon_warrior_3 жыл бұрын
adios
@shanmukhchandrayama85083 жыл бұрын
what is the text book followed?
@LordMoopCow4 жыл бұрын
yeah but do you have a dfs on rs mate
@JesseLH883 жыл бұрын
I also played with trees at 7... real trees, like the wooden kind.
@linkon_9 жыл бұрын
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.. ???
@Joshuaposada9 жыл бұрын
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.
@thinhnguyenvan70033 жыл бұрын
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)
@РоманБожко-ф6й7 жыл бұрын
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.
@aryangoyal58234 жыл бұрын
descendant word applies only when node is a tree edge of that ancestor
@bharathkotha7 жыл бұрын
why do we need V as an argument in DFS-Visit method ?
@xinliangzhu69447 жыл бұрын
It's the set of vertices.
@NiGhTzz29037 жыл бұрын
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.
@RudraSingh-pb5ls3 жыл бұрын
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 !
@worthaglimpse3 жыл бұрын
yessir we drop the 2 because 2v and v have the same asymptotic complexity
@VedhasDeshpande8 жыл бұрын
This guy is so cool! \m/
@allandogreat2 жыл бұрын
We don't pay, but we get!
@nanzibabasnin68617 жыл бұрын
which text does he follow , i wonder???
@karansaxena44227 жыл бұрын
CLRS is the textbook for the course, you can easily find it online.
@jossef1211 жыл бұрын
Well explained!, Thanks.
@mohansinghrawat43247 жыл бұрын
i think text book u have is cormen lieserson
@abaybektursun8 жыл бұрын
Thank you!
@IQisTwenty10 жыл бұрын
that's Erik ma boy
@neuron81863 жыл бұрын
ayo my boi are you ok its been 7 years how life goin?
@dhruvjoshi87444 жыл бұрын
28:34 can anyone explain it?
@linliu36654 жыл бұрын
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.
@aditheorigin49268 жыл бұрын
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?
@rbhambriiit8 жыл бұрын
+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!
@borzoualipourfard43687 жыл бұрын
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.
@panfayang11 жыл бұрын
i want a cushion, too.....
@Di5TuRBeD9 жыл бұрын
3:15 theoddone
@sizwesandile26448 жыл бұрын
Big YELLOW chalks prints White!
@BharCode094 жыл бұрын
That is yellow wrapper around white chalk i guess, to avoid sticking.
@vrindasinghal36544 жыл бұрын
That is the plastic chalk holder so the hands of the professor do not get dirty
@mohansinghrawat43247 жыл бұрын
thankyou sir....
@joeyalfaro23233 жыл бұрын
No I understand I loved algebra and geometry puzzles never understand what equals sign ment. Never even fazed me best way to learn anything pic good tracher
@sianmuanthangmilun61048 жыл бұрын
He knew a smattering of DFS when he was 7 years old. Morale: Not all precocious geeks end up like Mark Zuckerberg.
@ShakkIsLife7 жыл бұрын
mark zuckerberg is a complete noob compared to erik
@dylancutler19786 жыл бұрын
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.
@muslimx62638 жыл бұрын
I don't know how to thank you.. just thanks
@ajeet.y10 жыл бұрын
whats the criteria for MS in MIT for international students :)
@ashu7pathak5 жыл бұрын
Have you found it out in 5 years ?
@rj-nj3uk4 жыл бұрын
Hello tell me what you found.
@dipsacedemy2 жыл бұрын
Hey ajeet . I am pooja. Did you found anything in 7 years ?
@davidFbeckham4 жыл бұрын
Thanks my dawg
@giaple62374 жыл бұрын
Explanations are a little bit convoluted, particularly the codes. I think this lecturer does not like but has to follow the textbook.
@deonthomas781110 жыл бұрын
He keeps revering to the textbook, what is the title of the texbook and author
@mitocw10 жыл бұрын
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