12. Searching and Sorting

Поделиться
HTML-код
  • Опубликовано: 10 фев 2025

Комментарии • 144

  • @abhishekhawaldar569
    @abhishekhawaldar569 4 года назад +161

    This guy was the chancellor at MIT and yet teaches such basic concepts with sincerity and humility. Meanwhile most professors just brush over these topics assuming the students can learn it on their own. Massive respect !

    • @JH-ux1re
      @JH-ux1re 2 года назад +5

      Exactly! The less knowledgeable the more arrogant

    • @programmer1010
      @programmer1010 2 года назад +1

      42:12 merge isn’t logn iterations its at least n iterations and at most 2n iterations. You can see at 39:49 that number of prints(iterations) isn’t logn.
      37:32 we aren’t cutting down the problem in half, it’s a tree 40:33. It’s logn levels of iterations(not iterations themselves) where iterations at each level together have O(n) complexity(cost of each step(iteration) is O(n) but turns out that cost of steps at same level of a tree is also O(n) 41:24.
      He just mixes levels with steps 42:04
      Normally what we do is we multiply number of steps(O(n->2n)) to their complexity(O(n)) but in this case we use the fact that at each LEVEL of a tree sum of conplexity of steps is O(n).
      So number of LEVELS in a tree (O(logn)) multipled with each level’s complexity(O(n)) = O(nlogn)

    • @McAwesomeReaper
      @McAwesomeReaper Год назад +1

      @@JH-ux1re Perfectly explains his sentiments around the political divide.

    • @ildoguilhermeschneider4296
      @ildoguilhermeschneider4296 Год назад

      ​@@JH-ux1re😢😊😊

  • @VixyMan96
    @VixyMan96 4 года назад +181

    I've watched all the 12 lectures during corona time, I think professor Eric deserved a better audience, his jokes are really good and keep your attention through the course.
    Thanks MIT !!

  • @leixun
    @leixun 4 года назад +75

    *My takeaways:*
    1. Search algorithm 2:49
    2. Sorting a list is also linear complexity 8:09, but when we search for something, we often search many times, therefore the cost of sorting could be balanced 9:37
    3. Bogo sort (unbounded complexity) 11:00
    4. Bubble sort (quadratic complexity) 12:48
    5. Selection sort (quadratic complexity) 18:20
    6. Merge sort (log-linear complexity) 26:20, and why it is efficient 32:55, it is the best we can have (considering worst cases not average cases)

  • @CamiloDS
    @CamiloDS 5 лет назад +6

    For someone watching this. Make sure you do the problem sets. These classes mean nothing without them. It has been a great experience watching all the videos

  • @marco.nascimento
    @marco.nascimento 5 лет назад +47

    It has been an amazing learning experience to watch those 12 MIT lectures, I am really thankful to the institution for making all this avaiable to everyone, It's been really helpful. Incredible teachers and great lectures, already looking forward for the next course I will certainly "attend" hehe cheers from a brazillian comp science undergrad

  • @tomifg
    @tomifg 4 года назад +12

    I'm so grateful for MIT and everyone who helps support OCW. This course was an incredible experience and i can't believe I just did it from Argentina, during an economic crisis. Thank you!!!

  • @TheDinosaurHead
    @TheDinosaurHead 8 лет назад +62

    Thank you MIT, I really enjoyed this class.

  • @dayzed_gecko
    @dayzed_gecko 7 лет назад +12

    You did in one lecture, what my shitty lecturer tried to do in a week. Very good, simple and accurate.

  • @RussTeeTrombone
    @RussTeeTrombone 6 лет назад +2

    I’m in awe such incredible lectures are available free of charge on the internet. This far exceeded the quality of any CS course I’ve taken to date.

  • @dominikklon1985
    @dominikklon1985 4 года назад +31

    One of my biggest dream was studying at MIT, I was pretty optimistic about that till I was like 16yo when I realise it is impossible, bcs I live in central Europe and I also needed to pass some difficult times so I didn't tryhard learning as much as I wanted to. These courses are making my dream partly realised. I'm so grateful for that, thank you

  • @zigginzag584
    @zigginzag584 4 года назад +4

    Thank you very much for this free resource. I've memorized all the algorithms presented after running into what I would consider a severe mental block in trying to conceptualize them in my mind before memorizing them. I only share in case anyone else is struggling with trying to deeply understand the content, my suggestion is to first memorize the algorithms, type them out a few hundred times, line by line, through memory, then the concepts will solidify in your mind and you can start to adapt them to other facets of programming. I think we'd all like to pretend we're super-genius's that "get it" on the first go-round, but, at least in my case, it just doesn't work that way.

  • @rdwells
    @rdwells Год назад +1

    In the merge() function (35:14), if you change the first line of the for while loop to "if left[i]

  • @RyanScarbrough
    @RyanScarbrough 2 года назад +2

    Thank you Dr. Ana Bell and Prof. Grimson for the amazing lectures and all involved with OpenCourseWare for this course!

  • @tuanh9661
    @tuanh9661 Год назад +2

    by far the most amazing course I've taken, really thankful to you guys for taking the time and providing this

  • @atyantsony2013
    @atyantsony2013 4 года назад +1

    Thank You MIT-OCW from bottom of my heart....
    Thank You for your honest service. I really enjoyed this journey with both professors.
    THANK YOU :)

  • @yourtechbuddy101
    @yourtechbuddy101 4 года назад

    For explanation + implementation + Key points List and short notes on all sorting algorithms with doubt support : ruclips.net/video/euL-Dk2PPgw/видео.html
    All English Videos have been uploaded by 25th June 2020 and from now hindi series will start.

  • @robpatty1811
    @robpatty1811 2 года назад

    Thanks MIT for producing such great content and making it freely available. This is the third MIT course that I have finished.

  • @ashu7pathak
    @ashu7pathak 5 лет назад +2

    Thank you MIT, even though I'm not attending your institute and not paying you any fees, I'm still able to learn from (atleast the so called/ supposedly) the best profs! ❤✌🇮🇳🇮🇳🇮🇳

  • @dezkightz
    @dezkightz Год назад

    That joke at the end was gold lmao, Prof. Grimson has a wonderful sense of humor

  • @scorpio19771111
    @scorpio19771111 3 года назад +1

    For folks struggling with how recursion code runs, the animation at 40:05 shows step by step what happens for the recursive merge sort code. Study it together with the code, and hope you get a clearer picture of recursion.

  • @鄭心和
    @鄭心和 4 года назад +3

    ​​0:00:00 Review 0:02:54 0:04:00 0:06:10
    0:08:26 Sorting will do you good
    0:12:32 ​BOGO sort
    0:13:58​ Bubble sort 0:15:58
    0:18:25 selection sort 0:20:00 0:22:02 0:23:50 ​0:26:00
    0:27:38​ Merge sort 0:30:00 0:32:26 0:34:28 ​0:36:26 ​0:38:12​ 0:40:02
    0:42:00 ​0:44:00 ​
    0:46:10 ​What do computer scientist do 0:47:06

  • @hermionegrful
    @hermionegrful 4 года назад +6

    This was amazing. Thank you professor for making me understand these concepts so easily. I’ve been trying to understand these concepts for so many years and now I feel like I truly get it. A gifted teacher and thanks MIT for providing this!

  • @ricj9594
    @ricj9594 4 года назад

    Thank you! hopefully the education in Brazil will get better because of your wonderful free courses. God Bless the whole world and you all.

  • @jfbjavaforbeginners4176
    @jfbjavaforbeginners4176 3 года назад

    This the best ever cs course I have ever seen on youtube
    Thank you so much MIT you helped a lot

  • @micahd7255
    @micahd7255 6 лет назад +87

    These guys are great!! I'm now accepting donations to buy Ana and Prof. Grimson a second pair of clothes.

    • @laksitowp
      @laksitowp 4 года назад +2

      They didn't record these in 1 day?

    • @mvisperas
      @mvisperas 4 года назад

      It looks like they recorded these videos in one day.

    • @kneerelief577
      @kneerelief577 4 года назад +2

      @@mvisperas so the students are actors?

    • @mvisperas
      @mvisperas 4 года назад +1

      @@kneerelief577 It means all the videos were shot in one day. Thus, their clothes appear to be the same. In game shows like Jeopardy, the host and the contestants bring different clothes so it appears the next show is actually the next day. The MIT videos are aimed at teaching, not vanity.

  • @钱俊杰-l4i
    @钱俊杰-l4i 3 года назад

    I am addicted to Dr. Grimson’s lectures

  • @amishakandi8450
    @amishakandi8450 4 года назад +3

    Thank you for these lectures! Very helpful for a highschool student interested in computer science.

  • @programmer1010
    @programmer1010 2 года назад

    Selection sort is like the opposite of bubble. In bubble after every loop we find the maximum one and put it at the end, in selection sort we just find minimum after each loop. If it was c++ we could’ve written len(L)-j for range of j in 15:07

  • @ductive
    @ductive Год назад

    Thanks for your efforts that made such gems available

  • @aviraljanveja5155
    @aviraljanveja5155 8 месяцев назад +1

    That ending was legendary :D

  • @danciulescurazvan1047
    @danciulescurazvan1047 2 года назад

    How is this only 125k views and a guy talking about pokemon cards has over 3 million views? Can't really comprehend how this amazing lecture is posted for free on youtube and ppl are not watching it (or at least as much as it should be watched )

  • @nicolasortiz2638
    @nicolasortiz2638 7 лет назад +1

    It has been great to follow these lectures. Thanks MIT and ocw

  • @titanfrost8445
    @titanfrost8445 5 лет назад

    Those lectures are a a great chunk of knowledge I needed. I really liked the way everything is explaned. Thanks MIT

  • @imagenitin
    @imagenitin 4 года назад

    Thank you Prof Eric and MIT team for these wonderful lectures !

  • @kirangajjala7148
    @kirangajjala7148 4 года назад +1

    Thank you MIT u guys are doing a great job ... This video made my learning easy in lockdown 🙏🙏

  • @OliviaLearns
    @OliviaLearns 3 года назад +1

    amazing lecture! I am so thankful this is available to us!

  • @rossgaller3662
    @rossgaller3662 5 лет назад +1

    Thank you MIT and thank you Prof. Grimson!

  • @danielkinyanjui5296
    @danielkinyanjui5296 4 года назад

    The proffessor's presentation is poetry 😎

  • @inflem9860
    @inflem9860 3 года назад

    "And we deliberately admit students of different heights so John can do this demo" lol, love these lectures!

  • @YoungLink51423
    @YoungLink51423 3 года назад

    I really liked your sense of humor

  • @ali51717
    @ali51717 6 лет назад +1

    professor Eric has been writing recursive solutions the whole course, so this time I spent 3 hours writing a recursive merge sort to find out it wasn't necessary to do it recursively,

  • @amywang8407
    @amywang8407 6 лет назад

    selection sort around 18:00

  • @centristlibertarian
    @centristlibertarian Год назад

    Thank you so much sir and ma'am!!

  • @johncampbell7868
    @johncampbell7868 4 года назад

    I wish I was in this lecture as bubble sort has been given a bad wrap, where:
    "for j in range(1, len(L)):" should be
    "for j in range(1, unsort_len(L)):"
    This would be a simple extension to the use of "swap" as "new_len". This saving was even observed in the lecture.
    Also, it would have made a very informative demonstration of quick_sort out on the steps on such a nice day.
    Merge sort also requires many storage allocations, which can be expensive and is another cost to consider with "compares", "swaps" and "allocates".
    Those steps would have been a great location for any divide and conquer sort, eg shell, merge or quick, and especially to demonstrate their difference.

  • @programmer1010
    @programmer1010 2 года назад

    42:12 merge isn’t logn iterations its at least n iterations and at most 2n iterations. You can see at 39:49 that number of prints(iterations) isn’t logn.
    37:32 we aren’t cutting down the problem in half, it’s a tree 40:33. It’s logn levels of iterations(not iterations themselves) where iterations at each level together have O(n) complexity(cost of each step(iteration) is O(n) but turns out that cost of steps at same level of a tree is also O(n) 41:24.
    He just mixes levels with steps 42:04
    Normally what we do is we multiply number of steps(O(n->2n)) to their complexity(O(n)) but in this case we use the fact that at each LEVEL of a tree sum of conplexity of steps is O(n).
    So number of LEVELS in a tree (O(logn)) multipled with each level’s complexity(O(n)) = O(nlogn)

  • @chands.3207
    @chands.3207 4 года назад

    A BIG THANKS TO MIT.

  • @ibradalmar3764
    @ibradalmar3764 3 года назад

    Much thanks to OCW

  • @Lupain_classic
    @Lupain_classic 2 года назад

    Thank you professor for teachings

  • @tarekghosn3648
    @tarekghosn3648 3 года назад

    i love this dude man

  • @tieu.phu.quiiii
    @tieu.phu.quiiii 2 года назад

    Thank you very much. From Vietnam ^^

  • @dve845
    @dve845 5 лет назад

    2:53 linear search (mentioned) is not the same as sequential search (what is meant here)

  • @nicholasestrella339
    @nicholasestrella339 3 года назад

    I feel like Prof. Grimson's true calling was to be a comedian. The dude is really funny!

  • @anonymous.youtuber
    @anonymous.youtuber 3 года назад

    “And we deliberately admit students of different height so we can do this demo”Hilarious 😂. I really appreciate your jokes, Professor !

  • @OmigosTV
    @OmigosTV 4 года назад

    thanks a lot.Very interesting and livefull lections for self education

  • @محمدمصطفى-س9ع
    @محمدمصطفى-س9ع 2 года назад

    what a closure!

  • @abigiyatadesse2672
    @abigiyatadesse2672 2 года назад

    Thank you so much.

  • @annebortoli
    @annebortoli 3 года назад

    Best professor ever!!!

  • @jiayuyan4296
    @jiayuyan4296 2 года назад

    Thank you

  • @xer_t3661
    @xer_t3661 3 года назад

    Thank you very much! 💖🙂

  • @dve845
    @dve845 5 лет назад

    15:25 better turn the meaning of the swap flag upside down ... if you swap things set swap to True

  • @kooser6
    @kooser6 5 лет назад

    Thank you MIT!

  • @ankurg132
    @ankurg132 4 года назад +1

    For anyone watching this as a beginner and want to learn more computer science courses, here is the list of free courses through which you can learn sequentially - github.com/ossu/computer-science

    • @hicham5770
      @hicham5770 4 года назад +1

      Very useful. Thanks!

  • @arjunsagar130
    @arjunsagar130 5 лет назад

    Thank you MIT.

  • @darianharrison4836
    @darianharrison4836 7 лет назад

    love this lecture, very interesting!! thank you so much for the videos, now... to give all of this some good use =P

  • @codesha
    @codesha 4 года назад

    Made My Life! Thanks Sensei!

  • @devesh3648
    @devesh3648 5 лет назад

    Amazing lectures! Thanks OCW. Also, what should be the next course that I should take after this? (considering I want to get good at the use of data structures and algorithms)

  • @adiflorense1477
    @adiflorense1477 4 года назад

    day during quarantine .sounds good

  • @HoudekM
    @HoudekM 5 лет назад +2

    Great lectures and great lecturers. And I liked the jokes :) Thank you.

  • @yamalokesh2657
    @yamalokesh2657 4 года назад

    The classes are very good. I wish there were more classes to explain the algorithms in detail

    • @MrTc1004
      @MrTc1004 4 года назад

      there is one more MIT OCW course called introduction to algorithms

    • @mitocw
      @mitocw  4 года назад +1

      See ocw.mit.edu/courses/find-by-topic/#cat=engineering&subcat=computerscience&spec=algorithmsanddatastructures to see what we have for algorithms. Best wishes on your studies!

  • @bingchengduan7361
    @bingchengduan7361 6 лет назад

    a very impressive lesson.

  • @jadenmax679
    @jadenmax679 5 лет назад

    Very informative, thank you.

  • @tycho103
    @tycho103 6 лет назад

    great explanations!

  • @gnatinator
    @gnatinator 6 лет назад

    Thank you MIT

  • @sciencethings5731
    @sciencethings5731 4 года назад +7

    He's actually quite funny

  • @akbarrauf2741
    @akbarrauf2741 8 лет назад

    thank you ,mit

  • @ZhenyuWu-i5h
    @ZhenyuWu-i5h 5 лет назад

    Thank you !!! it's great

  • @김선민-t7f
    @김선민-t7f 6 лет назад

    I think bubble sort print statement should be right after the if statement

  • @cnasir3475
    @cnasir3475 4 года назад

    This is awesome

  • @balanceyourmind5674
    @balanceyourmind5674 4 года назад

    This is amassing lecture . Please can you say where the first 11 lectures .

    • @mitocw
      @mitocw  4 года назад

      Here's the playlist for the series: ruclips.net/p/PLUl4u3cNGP63WbdFxL8giv4yhgdMGaZNA. For more info, see the course on MIT OpenCourseWare at: ocw.mit.edu/6-0001F16. Best wishes on your studies!

  • @maninarush2112
    @maninarush2112 6 лет назад +4

    Raymond Hettinger would have a bird if he saw the abomination at 3:58

  • @McAwesomeReaper
    @McAwesomeReaper Год назад

    Is it required at MIT that profs wear the same outfit for every lecture, or is that just a consequence of filming for the video series?

  • @typehints
    @typehints 7 лет назад +5

    34:42

  • @jemsmilner4416
    @jemsmilner4416 6 лет назад

    wooow so fantastic!!!

  • @MrSrijanb
    @MrSrijanb 7 лет назад

    thanks mit!!!

  • @seanliu3549
    @seanliu3549 5 лет назад +1

    I really hope he is my cs professor, such an adorable person

  • @Damoon2543
    @Damoon2543 6 лет назад

    Thank you MIT wonderful lectures. @ Eric awful jocks ;)

  • @sagartomar4210
    @sagartomar4210 6 лет назад

    that was fantastic :)!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

  • @061_arsh
    @061_arsh 3 года назад

    34:30 what programming language is this ??

    • @mitocw
      @mitocw  3 года назад

      Python (v3.5). For more information and materials, see the course on MIT OpenCourseWare at: ocw.mit.edu/6-0001F16. Best wishes on your studies!

  • @gauravshukla5203
    @gauravshukla5203 5 лет назад

    Please provide algorithms course for c++

  • @raihantanvir8880
    @raihantanvir8880 2 года назад

    All classes included?

    • @mitocw
      @mitocw  2 года назад +2

      Yes. For more info and materials, see the course on MIT OpenCourseWare at: ocw.mit.edu/6-0001F16. Best wishes on your studies!

  • @BenyNotNice
    @BenyNotNice 3 года назад

    👏👏👏👏

  • @tombrady7390
    @tombrady7390 4 года назад

    i gave applause without him telling

  • @samuelmurmu3163
    @samuelmurmu3163 4 года назад

    why was my college not showing this kind of example

  • @JuhiGupta-pw2cb
    @JuhiGupta-pw2cb Год назад

    What should I watch after this video?? Anyone??

    • @mitocw
      @mitocw  Год назад

      Playlist for the course:ruclips.net/p/PLUl4u3cNGP63WbdFxL8giv4yhgdMGaZNA
      Course materials: ocw.mit.edu/6-0001F16
      Best wishes on your studies!

  • @mathabahassan3471
    @mathabahassan3471 3 года назад

    20:00

  • @labrecheabdelatif7188
    @labrecheabdelatif7188 6 лет назад

    the playlist link please !!!!

    • @mitocw
      @mitocw  6 лет назад +1

      ruclips.net/p/PLUl4u3cNGP63WbdFxL8giv4yhgdMGaZNA

  • @kiit-etc-etc-qi4mc
    @kiit-etc-etc-qi4mc 7 лет назад +2

    are there lectures after this.?

    • @mitocw
      @mitocw  7 лет назад +5

      No more lectures after this one. See the course on MIT OpenCourseWare for more details at ocw.mit.edu/6-0001F16.

    • @konet1440
      @konet1440 7 лет назад +6

      there is a follow up course which is 6.0002

  • @jivillain
    @jivillain 4 года назад +1

    Again, the only thing that is not good is “a-gain”

  • @dongguodan2128
    @dongguodan2128 5 лет назад

    Great though difficult ~~

  • @TURALOWEN
    @TURALOWEN 2 года назад

    Great lectures. Jokes cut the flow of the lecture tho.