2. Divide & Conquer: Convex Hull, Median Finding

  Рет қаралды 203,651

MIT OpenCourseWare

MIT OpenCourseWare

Күн бұрын

Пікірлер: 97
@anythingstudio5208
@anythingstudio5208 2 жыл бұрын
Course starts at 7:10 Merging convex hull 23:59 Median finding 53:29
@coolclay27
@coolclay27 8 жыл бұрын
Srinivas Devadas is the best lecturer I have ever encountered. He's amazingly clear, but does not over-explain. It's a pity he's not teaching 6.046 anymore.
@mrloldude135
@mrloldude135 8 жыл бұрын
Median finding @53:29
@wendyyhampton
@wendyyhampton 5 жыл бұрын
52:16 *
@thedailynoodle8363
@thedailynoodle8363 8 жыл бұрын
You guys really stepped up the camera work
@DrPastah
@DrPastah 6 жыл бұрын
lol
@alute5532
@alute5532 2 жыл бұрын
Convex hull hull 11:00 Definition 12:27 Smallest polygon containing all points ch(S) Sequence boundaries Doubly LinkedList 21:14 Break me up by drawing half-planes Left plane is one sub problem Right line is another problem Find convex hull for each of subprolems -when you get a hint brute force won't work 47:10 how do o remove the lines Find upper tangent & lower tangent
@bleakmess
@bleakmess Жыл бұрын
convex hull is better from 07:00
@niazahmad7823
@niazahmad7823 3 ай бұрын
I initially found it confusing when, around the 38:00 mark, it seemed like every single element in the left hull was being compared with b1. This led me to wonder if, in the worst case, we might end up comparing every element of the left hull with every element of the right hull, which would be highly inefficient. However, that’s not actually the case. The reason they compare elements with b1 is because b1 represents the maximum value at that point in the process. The code clarifies that each element is processed only once. For example, if b4 proves to be a better candidate, it replaces b1 and the comparison moves forward. If b1 was revisited, it would indicate that no better candidate was found, meaning b1 only needs to be processed as the best candidate for that moment. Apologies if I didn’t explain it clearly.
@jayquelin
@jayquelin 7 жыл бұрын
Such a brilliant lecture --i particular love the visual examples!! Thank you MIT OWC
@akshat1234100
@akshat1234100 4 жыл бұрын
i love the 720p after watching 6.006 in 360p
@jimmypi7
@jimmypi7 5 жыл бұрын
Did anyone find maybe the definition of rank at : 501 00:53:37,070 --> 00:53:53,880 And so in general, we're going to define, given a set of n numbers, define rank of x 502 00:53:53,880 --> --00:54:06--,510 as the numbers in the set that are greater than-- I'm sorry, less than or equal to x. 503 00:54:06,510 --> 00:54:09,270 I mean, you could have defined it differently. We're going to go with less than or equal 504 00:54:09,270 --> 00:54:10,750 to. is a typo? I checked the written note and find "number of numbers in the set that are smaller than x" makes more sense compared to rank defined on the black board in the video as "numbers in the set that are smaller than x" In short : "number of numbers in the set" versus "numbers in the set "
@SkSami007
@SkSami007 8 жыл бұрын
A bunch of thanks for your video lessons. It really helps me understand the Algorithm a way deeper..
@vermoidvermoid7124
@vermoidvermoid7124 7 жыл бұрын
really good lecture, well explained.. especially the visual cues
@weitengli179
@weitengli179 5 жыл бұрын
44:00 Gift wrapping may be better than devide & conquer; it has O(nh) time complexity (not nlogn as the professor mentioned), where n is the number of points and h is the number of points on the convex hull. en.wikipedia.org/wiki/Gift_wrapping_algorithm
@erikjohnson1925
@erikjohnson1925 4 жыл бұрын
Good point! And if one allows for an output sensitive algorithm, then the asymptotically optimal algorithm is either Chin's Algorithm or Kirkpatrick-Seidel with O(n log h) time
@keelwakamar
@keelwakamar 4 жыл бұрын
Can't i propose a situation where all points are on the convex hull? If that case were true, then it's complexity would basically be O(n²) right?
@erikjohnson1925
@erikjohnson1925 4 жыл бұрын
@@keelwakamar I don't think this is correct. I think that if you keep track of points on the hull, you only need to check the "open" end (assuming that point is actually on the hull e.g. lowest x-value point which can be found in O(n)). This means the number of points to check decreases by 1 on every iteration
@keelwakamar
@keelwakamar 4 жыл бұрын
@@erikjohnson1925 you still get O(n²) when you do asymptomatic analysis on that. You can try it yourself, or check how selection sort is O(n²) eventhough it does exactly what you mentioned.
@erikjohnson1925
@erikjohnson1925 4 жыл бұрын
@@keelwakamar My mistake, you are completely correct. For some reason, I really expected that case to degenerate to O(n log n). I guess you need Chin's Algorithm or Kirkpatrick-Seidel to get the O(n log n) when all points lie on the hull
@kirillkozlov5395
@kirillkozlov5395 5 жыл бұрын
b2 and b4 switch places at 36:15, so the points in "b" sub-convex hull become ordered counter-clockwise
@superdupe8
@superdupe8 4 жыл бұрын
convex hull explanation = good median finding = not so good. Then again, I feel like he didn't have enough time. There's a lot of steps to the median problem, but he was definitely rushing through it and more or less just telling the answer instead of giving much intuition behind it.
@ceciliaw1065
@ceciliaw1065 2 жыл бұрын
Crystal clear explanation, what an amazing lecturer, just wow
@ericwilson8665
@ericwilson8665 2 жыл бұрын
Fantastic example. That's so appreciated. Made it so clear.
@kaushikmangaprasad4575
@kaushikmangaprasad4575 7 жыл бұрын
So is he finding the median of medians using the same approach again?
@donotreportmebro
@donotreportmebro 11 ай бұрын
53:40 Big Theta is rarely satisfactory. We want big O to be optimal, specifically O(n) in the case of finding a median.
@dwarakeshkotipatruni6578
@dwarakeshkotipatruni6578 9 ай бұрын
Bro I didn't understand the whole lecture can you please help me
@charlottetreesageorge2230
@charlottetreesageorge2230 3 жыл бұрын
Thank you so much for making this available for all
@dohyun0047
@dohyun0047 4 жыл бұрын
In median of median do we sort the "medians" row too? if not how can we guarantee those picture? @1:12:11
@gnpar
@gnpar 2 жыл бұрын
You don't need to sort them or arrange them like that, you just need to find the median of that row. The pictures are simply to show that once you find it, you have a situation where roughly half of the elements are < x and roughly half are > x. Once you have x you go back to the original problem and, since your pivot is now roughly in the middle, you have O(n) complexity on the D&C algorithm.
@jayhoeliotdecabrio4050
@jayhoeliotdecabrio4050 3 жыл бұрын
please note that the diagram numbering is done worng by mistake if you trace the algorithm with the diagram drawn by professor then you will get confused so check out the notes at ocw.
@o.y.930
@o.y.930 3 жыл бұрын
can somebody explain why is it T(n/5) and not 5T(n/5) in 1:17:29. Aren't we doing the recursion 5 times each step.
@mytennisjourney4949
@mytennisjourney4949 3 жыл бұрын
N elements divided into N/5 columns, each column is sorted by constant time, every column has a median, so there are N/5 medians. And we use algorithm recursively, we find the median of these medians, which means T(n / 5)
@mytennisjourney4949
@mytennisjourney4949 3 жыл бұрын
The key point here is that the problem we need to solve is find median, we assume we solve the problem, and we use this solution to find “median of medians” (pick X in lesion), to help us solve the problem “find a median”.
@hungrypigeon7246
@hungrypigeon7246 4 жыл бұрын
How do we prove that the figure formed in the first case by joining the segments convex?
@shampoable
@shampoable 3 жыл бұрын
assuming the result of ConvexHull(Set) is a doubly linked list, wouldn't combining two of them be O(1), as only 4 points need to be linked?
@tuhinmukherjee8141
@tuhinmukherjee8141 3 жыл бұрын
Yes, true but the complexity lies in the determination of the four points to be linked.
@niazahmad7823
@niazahmad7823 3 ай бұрын
"while (y(i, j + 1) > y(i, j) or y(i − 1, j) > y(i, j)) if (y(i, j + 1) > y(i, j)) [ move right finger clockwise j = j + 1( mod q)" My question is how is this code moving the point in the clock-wise direction it is just incrementing j and there could be a point that has j just next to the one we are currrently on and it could lie in the anti-clock wise fashion. How is this code making sure that it moves it in the clockwise direction?
@olier1
@olier1 8 жыл бұрын
2015 and one of the best Technical University still use blackboard
@jamesking2439
@jamesking2439 7 жыл бұрын
The blackboard sets the mood.
@WayneRadinsky
@WayneRadinsky 7 жыл бұрын
It works.
@lekhoa6552
@lekhoa6552 8 жыл бұрын
awesome explanations!!!
@SandyRocks007
@SandyRocks007 6 жыл бұрын
Merging convex hull 23:59
@Renembrence
@Renembrence 5 жыл бұрын
You fucking saint I love you
@stormanning1163
@stormanning1163 7 жыл бұрын
Excellent explanations!
@holdenmcgroin8917
@holdenmcgroin8917 3 жыл бұрын
The BS stops at 7:10
@badr-eddineelbatouri4544
@badr-eddineelbatouri4544 3 жыл бұрын
there is a small problem, when having n point we can only draw n*(n-1)*2 segments not n*n. having 3 point ABC will result in AB AC BC BA CA BC and if we are using dynamic programming we can remove the BA CA CB thus AB AC BC only.
@venkateshnaresh966
@venkateshnaresh966 2 жыл бұрын
yes, that's true. But look at the order of growth. The dominant term here is n^2. The linear term is ignored since it doesn't grow as fast as the quadratic term
@WeirdAlSuperFan
@WeirdAlSuperFan 2 жыл бұрын
Yeah that's O(n^2). Also you meant n(n-1)/2 (n choose 2). Don't sweat the small stuff in complexity calculations
@naomim1207
@naomim1207 4 жыл бұрын
Why used a Doubly Linked List for Convex Hull?
@Tibetan-experience
@Tibetan-experience 8 жыл бұрын
thank you
@Drethron
@Drethron 8 жыл бұрын
May not divide and concur as easily but couldn't you average all of the points to find the center, then determine if a point is a smaller raduis away relative to the points on either side? Either way, very nice videos so far.
@tear728
@tear728 8 жыл бұрын
I'm pretty sure that would be O (n^2) still. I might be wrong on that though
@thinhnguyenvan7003
@thinhnguyenvan7003 3 жыл бұрын
Can someone explain for me that. Why Arrange S into columns of size 5 and sort each column take linear time? suppose that sorting take oder nlogn. So time complex here is k* 5log5 time which is k equal n/5.
@gnpar
@gnpar 2 жыл бұрын
You just explained it yourself. You ended up with complexity (n/5)5log5. That's n multiplied by some constant log5, it's still O(n). Note that it would be exactly the same if sorting took n^4 or 4^n, it doesn't matter, you're always sorting five elements.
@loona8398
@loona8398 2 ай бұрын
I really don't know why I have such a thick brain when it comes to algorithms?
@jeongminyoun5388
@jeongminyoun5388 4 жыл бұрын
Where did 7n+7/10 + 7 come from in the end?
@bhavneetsingh6893
@bhavneetsingh6893 7 жыл бұрын
why it is n3 at 20:45
@diegoarcelli8902
@diegoarcelli8902 4 жыл бұрын
I think because there are O(n^2) possible segments and for each of them you have to verify if the n points (except for the two crossed by the segment) are all in one of the two half plain defined by the segment. So you do an O(n) operation O(n^2) times therefore the cost is O(n^3).
@dineshjagai
@dineshjagai 5 жыл бұрын
Great lecture :D
@shubhamtalks9718
@shubhamtalks9718 6 жыл бұрын
median finding kzbin.info/www/bejne/e6vIinxtpZ6AoLc 52:18
@DommageCollateral
@DommageCollateral Жыл бұрын
thanks. better than my frkn uni
@videofountain
@videofountain 8 жыл бұрын
At this time point kzbin.info/www/bejne/e6vIinxtpZ6AoLch1m27s ... the chalk writing was likely intended to be recursively ... [return Select(C, i-k)] ... rather than ##[return (C, i -k)]##. [Select] function name for recursion.
@rbrtchng
@rbrtchng 8 жыл бұрын
how do you get the medium of mediums?
@anmol-gupta
@anmol-gupta 4 жыл бұрын
If we have n/5 columns then to find the median of medians we'll have to call the Select function on the list of medians. We're basically computing 1 subproblem that is 1/5th the size of the original. Hence, the T(n/5) term for finding the median of medians.
@JSGT9016
@JSGT9016 Ай бұрын
I wish i could be intelligent enough to understand this enough to make it into code....but I am below average IQ for this.
@bisnusarkar9678
@bisnusarkar9678 6 жыл бұрын
it is an awesome lecture...
@KeshariPiyush24
@KeshariPiyush24 3 жыл бұрын
Median of Median part is not good....other than that amazing lecture
@Upendra237
@Upendra237 5 ай бұрын
🎉
@brendawilliams8062
@brendawilliams8062 3 жыл бұрын
Thx.
@Outloud444
@Outloud444 6 жыл бұрын
Merging 2 groups … as they both want ALL the MONEY -- good luck --- Pay to Play -- Money is #1
@mritunjay_99
@mritunjay_99 4 жыл бұрын
Where is Morty?
@kevidimitrisceci8096
@kevidimitrisceci8096 4 жыл бұрын
I don't know why someone has to go to university when exists this.
@olaafelumo4754
@olaafelumo4754 4 жыл бұрын
Dimitris Ceci I know right ? But you get tested in school. You don’t get tested here
@marlow893
@marlow893 8 жыл бұрын
recording could be better if at least a few seconds is left to see the board without the teacher. easier to take notes.
@atulavhad1661
@atulavhad1661 7 жыл бұрын
You could pause the video while taking notes or download the subscripts. Also, lecture notes are available on ocw.mit.edu
@rishabharijeet4151
@rishabharijeet4151 Жыл бұрын
40:33
@nikolapetrovic4415
@nikolapetrovic4415 4 жыл бұрын
Whether this video is accelerated or this guy just has too fast movements?
@tirthjayswal9895
@tirthjayswal9895 5 жыл бұрын
bestttttttttttttttttttttttttttt
@aobcd.8663
@aobcd.8663 4 жыл бұрын
I feel other videos for DS are more useful than these famous universities. These guys presume you know everything
@jamesbrean8004
@jamesbrean8004 6 ай бұрын
LoL
@prajapatarun5711
@prajapatarun5711 4 жыл бұрын
Again Indian fella
@rahulkashyap840
@rahulkashyap840 6 жыл бұрын
kya bkwas pda rh a h yaar
@faisalsal1
@faisalsal1 5 жыл бұрын
The course is too much abstract and theoretical with a high dose of verbosity. Just cut the chase and demonstrate using a sample of numbers how the algorithm finds the medium? Too much beating around the bush without hitting the point. I believe these kind of courses are only to pass the exams but definitely useless if preparing for technical interviews or to solve any programming challenge.
@debarkasengupta5351
@debarkasengupta5351 5 жыл бұрын
Slides would save a lot of his time, perhaps more content can be delivered.
@mitocw
@mitocw 5 жыл бұрын
Lecture notes are available on MIT OpenCourseWare at: ocw.mit.edu/6-046JS15. Best wishes on your studies!
@ankushm3t
@ankushm3t 4 жыл бұрын
meh, slides are bad for teaching IMO. I found all black board type lectures much easier to follow even at 1.5x speed
@Outloud444
@Outloud444 6 жыл бұрын
Funny .. YOU ALL would wind up DEAD -- using this formula -- you are better off -- using John Nash's Equilibrium Theory
R1. Matrix Multiplication and the Master Theorem
53:46
MIT OpenCourseWare
Рет қаралды 73 М.
3. Divide & Conquer: FFT
1:20:52
MIT OpenCourseWare
Рет қаралды 321 М.
快乐总是短暂的!😂 #搞笑夫妻 #爱美食爱生活 #搞笑达人
00:14
朱大帅and依美姐
Рет қаралды 14 МЛН
How To Choose Mac N Cheese Date Night.. 🧀
00:58
Jojo Sim
Рет қаралды 114 МЛН
Creative Justice at the Checkout: Bananas and Eggs Showdown #shorts
00:18
Fabiosa Best Lifehacks
Рет қаралды 34 МЛН
Convex Hull Algorithm - Graham Scan and Jarvis March tutorial
7:24
Closest Pair of Points (Divide and Conquer) Explained
8:45
Coding Challenge #148: Gift Wrapping Algorithm (Convex Hull)
22:28
The Coding Train
Рет қаралды 158 М.
4. Divide & Conquer: van Emde Boas Trees
1:20:15
MIT OpenCourseWare
Рет қаралды 77 М.
Cosmology Lecture 1
1:35:47
Stanford
Рет қаралды 1,1 МЛН
Daniel Everett, "Homo Erectus and the Invention of Human Language"
1:10:43
Harvard Science Book Talks and Research Lectures
Рет қаралды 530 М.
Convex hulls: Jarvis march algorithm (gift-wrapping) - Inside code
11:18
26. Chernobyl - How It Happened
54:24
MIT OpenCourseWare
Рет қаралды 2,9 МЛН
2023 MIT Integration Bee - Finals
28:09
MIT Integration Bee
Рет қаралды 2,1 МЛН
4. Molecular Genetics I
1:33:35
Stanford
Рет қаралды 2,2 МЛН
快乐总是短暂的!😂 #搞笑夫妻 #爱美食爱生活 #搞笑达人
00:14
朱大帅and依美姐
Рет қаралды 14 МЛН