CS50x 2024 - Lecture 3 - Algorithms

  Рет қаралды 353,416

CS50

CS50

Күн бұрын

Пікірлер: 311
@paul6096
@paul6096 3 ай бұрын
This class is absolutely wonderful. I'm a 75 year old retired computer network engineer with multiple grad degrees in computer science (in the early 80's, long before Windows). I haven't programed in C (I also did Pascal, Dbase, and SPSS) in over 35 years. Network work was rather different. This class has given me the opportunity to revive some dormant brain cells, dormant from age and the effects of a stroke 10 years ago. It's very satisfying to be able to do this work again. Thank you for this class. I look forward to finishing this class and continuing on to the to the Python programing class and any other of these class that are available. One step at a time.
@davidjmalan
@davidjmalan 3 ай бұрын
Glad you've enjoyed so!
@chamyn8995
@chamyn8995 3 ай бұрын
Thanks for your contribution to the computer sciences, grandpa.
@MadhusudanSinha
@MadhusudanSinha 2 ай бұрын
I am 33 and had a feeling that I might be late to programming. Thanks Gramps.
@504octo
@504octo Ай бұрын
Same boat here! I'm having lot of fun with this class for the 1st time 25 years Network Engineer with multiple specs. I've learned Cobol and Qbasic for games even before win 3.11. Got into Video Games Dev this year and learning C and then Python. I was stressed by it. However, I guess my prays were listened and the Internet algorithm led me here. The same as you, my programming brain cells were dormant but this course is getting them out of sleep and the results, are impressive!
@algirdasltu1389
@algirdasltu1389 27 күн бұрын
Damn thats a long time ago... cant imagine getting those degress when there was barely any abstraction and c was the highest level you had...
@Hellmiauz
@Hellmiauz Ай бұрын
What a time to be alive. Thanks David for leaving this legacy to humanity for those who can't attend harvard. I finished CS50P and now fighting my way through CS50X. Hopefully I can complete it before the year ends😊
@ViniSouza93
@ViniSouza93 9 ай бұрын
The experience of studying this course is amazing, I feel that I´ve learned more in the last weeks that I´ve learned in a full year of a Technologist Degree
@MrArkaneMage
@MrArkaneMage 7 ай бұрын
Yes, especially the "training" wheels make things way more clear plus once you try to translate it into "real C" you really learn a lot in the process. No degree here but this course is pure gold for everyone interested in PCs, coding, etc.
@CườngNguyễnPhú-n2i
@CườngNguyễnPhú-n2i 6 ай бұрын
same to me haha 😅
@divineihemadu3287
@divineihemadu3287 Ай бұрын
The fact that I'm getting Harvard level of education at no cost( except for the cost of internet connection) is just amazing. David Malan is so awesome and I would love to one day teach the newer generation what I've learned as passionately as this man❤😊
@hamidrezaparand4909
@hamidrezaparand4909 9 ай бұрын
This course is just amazing. And how good of a teacher is he is 🥶
@luxxer9591
@luxxer9591 9 ай бұрын
I love the fact that they dont put ads, full concetration Mode [on]
@shizaikhlaq6096
@shizaikhlaq6096 4 ай бұрын
WHAT A BOUNDING, what an engagement. i have never used to watch 30 minutes long video and I am watching thee series complete and without getting bord. allah bless the team who are arranging such amazing content for us , blessed people are those who are sitting in different countries and are getting this god gifted channel as a gift becoz normally we are unable to find such amazing and accurate content. Amazing amazing , hats of to David Malon and the teams managing this amazing channel. i don't have words to praise. superb superb and superb. allah gives you the whole world's success
@sandevv-k7q
@sandevv-k7q 10 ай бұрын
I can't believe this that this level content is free!,
@toke7342
@toke7342 8 ай бұрын
Why not?
@saqib7685
@saqib7685 8 ай бұрын
@@toke7342 because they some course which are shit expensive but are not as good as this
@valentina7901
@valentina7901 7 ай бұрын
@@toke7342 you have madd comprehension skills
@purelyjoel6428
@purelyjoel6428 2 ай бұрын
you should, also all education should be ;) like living and food. or at least Basic needs shouldnt be smth you make profit with.
@palomasentadaestoysentado9096
@palomasentadaestoysentado9096 6 ай бұрын
I really like this teacher, its very good capting attention
@reynonquirimit6075
@reynonquirimit6075 10 ай бұрын
I vow to complete this program this 2024 No more excuses!
@misterguy
@misterguy 8 ай бұрын
And did you?
@reynonquirimit6075
@reynonquirimit6075 8 ай бұрын
@@misterguy Sadly not yet, currently stucked on week 5. It's difficult but i'd still keep going forward
@misterguy
@misterguy 8 ай бұрын
@@reynonquirimit6075 stuck on what, understanding the lecture, or doing the assignment that comes with it?
@BANTY-ie1ik
@BANTY-ie1ik 8 ай бұрын
@@misterguy assignment
@reynonquirimit6075
@reynonquirimit6075 8 ай бұрын
@@misterguy yeahh, currently stucked on pset5. Been quite busy
@dimaborovski1865
@dimaborovski1865 Ай бұрын
The fact that this level of education is absolutely free is mind boggling to me God bless the internet ❤
@stevenlomon
@stevenlomon 7 ай бұрын
Having blast going through this and doing the Problem Sets!! David is one of the most enthusiastic teachers I've ever seen and he explains things so wonderfully
@plague8953
@plague8953 7 ай бұрын
seriously!
@seeblu
@seeblu 11 ай бұрын
I vow to complete this program this year. Started in December of 2023.
@aneurismike
@aneurismike 10 ай бұрын
Wish you the best 👊.
@chekhovslasergun9175
@chekhovslasergun9175 10 ай бұрын
I'm with you, started in Dec too
@sefonefinpsefnpefn4191
@sefonefinpsefnpefn4191 10 ай бұрын
I am with you. I started last week. Keep going!
@ginniosikisama
@ginniosikisama 7 ай бұрын
started this week let's go
@kyan6985
@kyan6985 6 ай бұрын
How's your progress?
@lawfpv
@lawfpv 7 күн бұрын
I was a little worried when we brought up recursion with like 30 minutes left to explain it, but the section on merge sort was very enlightening as to the sequence that a recursive algorithm takes when solving a problem. Thanks!
@TALHA-hr6xf
@TALHA-hr6xf 3 ай бұрын
key learning point; The cs50 duck always has been and always will be.
@FigueMonk
@FigueMonk 6 ай бұрын
Learning all this free is awesome, God bless Internet
@freelance-writer
@freelance-writer 4 ай бұрын
Getting students up on stage and doing these "live body" exercises is such a great teaching method.
@marveII0us
@marveII0us 11 ай бұрын
Thanks prof David
@GrantReinauer
@GrantReinauer 9 ай бұрын
Seriously? 4k? HDR? Not only are the lectures amazing but so is the watching experience!!
@The.Oh1183
@The.Oh1183 6 ай бұрын
David: "Questions?" Me: "Can you repeat EVERYTHING?!"
@noah26blanco
@noah26blanco 5 ай бұрын
Exactly! I wish I could’ve been there to ask some questions myself 😂 because apparently everyone sitting there is a genius
@mariatanya3533
@mariatanya3533 Ай бұрын
@@noah26blanco Lmfaoo exactly! Like wow so y'all just understood that the first time? Ok then
@sk45293
@sk45293 9 ай бұрын
Recursion is wild
@Nillipilli
@Nillipilli 6 ай бұрын
Amazing video again. Really love the way how you explained running time, especially as I struggled understanding it during my studies but your explanation was really on point, thanks for that :)
@badguy7432
@badguy7432 5 ай бұрын
they briefed through everything without touching the codes yet. Sorting, binary search, recursion, structs, even 'scanf and fgets' are simplified with get_string. Man, the amount of stuff they teach yet the depths of it being touched in lectures is insane
@badguy7432
@badguy7432 5 ай бұрын
arrays are introduced without the talk about pointers too, culture shock for yall if yall go on into cs facing passing by reference and value
@ludwigthedwarf7678
@ludwigthedwarf7678 5 ай бұрын
Indeed, i do have no idea what pointers are and what you mean by reference and value
@barmiro
@barmiro 4 ай бұрын
@@badguy7432 the next lecture is about pointers, also the problem sets go much deeper. I'd say the lectures just touch on the basics and all the learning is actually done by coding. I'm also not a fan of the cs50 library, especially stuff like get_string and get_int, but I get why they decided to do it I guess.
@badguy7432
@badguy7432 4 ай бұрын
@@barmiro yeah figured, speak of the devil. Albeit, the sorting methods should’ve been way more in-depth in the lectures. This is way too fast for freshmen to comprehend especially mergesort in anything but c.
@besegawG
@besegawG 4 ай бұрын
@@badguy7432 where do you suggest I go learn about this in depth?
@riyajath_hmd
@riyajath_hmd 10 ай бұрын
Can't watch the lessons yesterday, as I was travelling. Finished the lecture 3 today and feeling more excited.
@noah26blanco
@noah26blanco 5 ай бұрын
Are still as excited after 5 Months? 😏
@MatthewIrizarry-4
@MatthewIrizarry-4 10 ай бұрын
Talking during 44:00 about return values…. In C, you can also return EXIT_SUCCESS or EXIT_FAILURE to make the code more readable
@mtarik0
@mtarik0 10 ай бұрын
That's a useful tip! I think it would be nice in small projects like we do in this course but in case of a large project, you may need to see what value the program returns with, like returning 1132 could help a programmer point which code snippet to deal with. Is that capable of doing so?
@MatthewIrizarry-4
@MatthewIrizarry-4 10 ай бұрын
@@mtarik0 You could just define a constant value to accomplish this. Say you wanted Error 653 to be an I/O error or BufferOverflow, whatever you wanted. #define BUFFER_OVERFLOW_ERROR 653 And when you used the BUFFER_OVERFLOW_ERROR it will return 653😁
@mtarik0
@mtarik0 10 ай бұрын
Is it possible to use both? If so, in the context of returning values as well as being helpful to a programmer, I feel like it becomes a bit redundant with this way. I might have missed your point though.@@MatthewIrizarry-4
@Nunoflashy
@Nunoflashy 10 ай бұрын
@@mtarik0 If your question is whether you can use both the number and the #define (constant), then yes, you can use both. The point of using #defines and constants in general is to make the code more readable. If you were to return that "653" code any time you had an I/O error for example, you probably wouldn't know what it meant, whereas with a descriptive name such as BUFFER_OVERFLOW_ERROR, you'd know exactly what it means and where it should be used.
@mtarik0
@mtarik0 10 ай бұрын
I wanted to ask whether it is possible to use EXIT_FAILURE and BUFFER_OVERFLOW_ERROR by #define (constant)@@Nunoflashy
@kingillager
@kingillager 3 ай бұрын
1:45:31 that silence, I felt that 😢
@magma4168
@magma4168 7 күн бұрын
Amazing lecture! And shout-out to Sam's hair 💖
@이이이-g4f2y
@이이이-g4f2y 6 ай бұрын
1:53:28 How to merge: The computer points to the first value in each of Lists (3 6) and Lists (1 4). Compare the two pointers and place the smaller value between 3 and 1 in the new list above. The left pointer still points to 3, and the right cursor now points to 4 . (num 1 went up) Compare the size of the two 3 and 4. Of the two, 3 is smaller, so put 3 in the list above, to the right of 1. Repeat this...
@littlebrotha123
@littlebrotha123 5 ай бұрын
i've watched some vids on recursion before, but this one, though it took its time, was one of the most eye opening ones. merge sort really gave me an "aha" moment as far as the power of recursive sorting
@nandinimatham8811
@nandinimatham8811 Ай бұрын
great lecture. most amazing way to explain sorting algo. Feedback: Bubble sort algo: running time is: (n-1)(n-1) = (n-1)^2, ignoring the -1 for laaaaaarge numbers, we directly get n^2, O(n^2)
@akfdglkjadfgjl
@akfdglkjadfgjl 12 сағат бұрын
I surely would have finished my CS study, if the teachers and students were this charistmatic. CS at TU Delft in '98 wasn't really the place to be. Great course for learning the basics and history, that I skipped!
@MaximeFontaine-ou3qc
@MaximeFontaine-ou3qc 6 ай бұрын
I can't believe you can actually call John Harvard ... Mr Mallan, this was genius.
@BaraBarabere.
@BaraBarabere. 10 ай бұрын
intro music GOAT!
@BaibhavDeka
@BaibhavDeka 11 ай бұрын
void selection_sort(int array[], int size) { // size = no of elemnts in the array for (int i = 0; i < size - 1; i++) { int smallest = array[i]; int j1 = i; for (int j = i+1; j < size; j++) { if (smallest > array[j]) { smallest = array[j]; j1 = j; } } if (j1 != i) { int temp = array[i]; array[i] = smallest; array[j1] = temp; } } return; } // code for selection sort
@chongxian7608
@chongxian7608 10 ай бұрын
why didnt he teach this tho. im pretty sure there would be better ways, kinda dissapointed about the later part of the lecture......
@loldoctor
@loldoctor 10 ай бұрын
@@chongxian7608Because he's setting up for the next lecture about memory. There are probably bitwise methods that would be blazing fast, but the point of the class is to teach CS concepts not how to optimize code.
@4562-j7y
@4562-j7y 10 ай бұрын
crazy how mixed the attendance is! Last year in my first CS class at University (in germany) we had like 15 girls and 200 dudes, the atmosphere here seems much more open
@troyyey4353
@troyyey4353 10 ай бұрын
hows is that relevant ? why you even care about that ?
@4562-j7y
@4562-j7y 10 ай бұрын
@@troyyey4353 how is it not relevant? Why should I not care about it?
@troyyey4353
@troyyey4353 10 ай бұрын
im not sure if you are joining the course for the right reasons if one gender is more present than the other can effect your decision , im not sure what are you worried about @@4562-j7y
@st.bimbam
@st.bimbam 10 ай бұрын
Because diversity is a good thing@@troyyey4353
@ernie5229
@ernie5229 9 ай бұрын
@@4562-j7yYou are so a girl. You are why there were only 15.
@BaibhavDeka
@BaibhavDeka 11 ай бұрын
void bubble_sort(int array[], int size) { // size = no of elemnts in the array for (int i = 0; i < size - 1; i++) { // compare adjacenies int no_swaps = 0; for (int j = 0; j < size - 1 - i; j++) { if (array[j] > array[j+1]) { int temp = array[j]; array[j] = array[j+1]; array[j+1] = temp; no_swaps++; } } if (no_swaps == 0) return; } return; } // code for bubble sort
@MohammedAbbasSyed-k5n
@MohammedAbbasSyed-k5n 2 ай бұрын
11:06 i saw a girl most probably trying to raise her hand for answer but unfortunately david didn't saw her as he was looking in another dircetion , i felt the pain of her
@Gha_210
@Gha_210 2 ай бұрын
bro it's not that serious lmao
@MohammedAbbasSyed-k5n
@MohammedAbbasSyed-k5n 2 ай бұрын
​@@Gha_210ik but just saying
@nikosworks
@nikosworks 3 ай бұрын
the best way of teaching
@bagumamartin
@bagumamartin 29 күн бұрын
Watching this one here in preparation for tomorrow's internship interview 🙌
@Zangetsu-gaTensho
@Zangetsu-gaTensho 2 ай бұрын
that draw recurrsion code makes no sense to me its literally calling draw() before ever drawing everthing Edit: so I got it now and this shit blew my mind 😭 (For anyone in my position, it's something like this if you put n = 2... The flow of commands is like I numbered below 1: draw(2) is called 2:N becomes 1 10: from step 9 execution Comes here as draw(1) was called here 11: loop runs 2 times 12: exits (goes back to main) 3:Draw(1) is called 4:N becomes 0 7: 0 is returned from step 6 8: Loop runs 1 times 9: exits 5:Draw (0) 6:Returns 0 to draw(0) place
@robertdiasmelo
@robertdiasmelo Ай бұрын
Robert from Brasil 🎉 Another excellent lesson! 🎉
@xuenf
@xuenf 7 ай бұрын
Sam is just chaotic adorable
@crypticsios2254
@crypticsios2254 3 ай бұрын
reals
@GenZ_01_
@GenZ_01_ 4 ай бұрын
Nothing short of gold!
@Creative_wazz
@Creative_wazz 2 ай бұрын
love from student aka fan , David! Thankyou
@bwaco7004
@bwaco7004 10 ай бұрын
cant wait to make sense of this through rigorous labs
@Tushaar-CSgym
@Tushaar-CSgym 2 ай бұрын
that recursion easter egg was pretty cool
@thefloatingrock
@thefloatingrock 4 ай бұрын
David is the GOAT
@sehlkd4r1nc31
@sehlkd4r1nc31 3 ай бұрын
Thank you, you are the best, i have not idea but i am learning
@zinmyolatt1386
@zinmyolatt1386 2 ай бұрын
I love this one! it's so fantastic!
@aasrp661
@aasrp661 3 ай бұрын
1:05:51 Gangsta dap up 😎
@zeynepuslu100
@zeynepuslu100 5 ай бұрын
started on june 2024. good luck everyone
@abdulmelik8337
@abdulmelik8337 5 ай бұрын
how much time do you spend on learning?
@100drips
@100drips 5 ай бұрын
Me too. Good luck to you
@NKLGaming01
@NKLGaming01 3 ай бұрын
23/08/2024. I will finish this course before 2024 !
@luizashabetnick8059
@luizashabetnick8059 3 ай бұрын
i really hope so too, starting aug 30th
@NKLGaming01
@NKLGaming01 2 ай бұрын
@@luizashabetnick8059 very lazy and bored. This lesson 14 days and i still not get over it
@sourabhhsethii7292
@sourabhhsethii7292 5 ай бұрын
Day 3 : Completed!
@botify9400
@botify9400 9 ай бұрын
Summary CS50x 2024 - Lecture 3 focuses on algorithms and implementation. It explores the concept of thinking algorithmically and how to solve problems using code. The lecture uses examples such as searching for a number in an array to demonstrate different algorithms. Highlights The lecture emphasizes the importance of thinking algorithmically. It discusses the concept of dividing and conquering a problem to find a more efficient solution. The lecture introduces the idea of arrays and their characteristics, such as being contiguous and potentially unordered. [🔍] The lecture uses the example of searching for a number in an array to explain algorithms. [📚] It relates the concept of divide and conquer to various real-world scenarios, such as searching contacts in your address book. [🔢] The lecture highlights the importance of understanding how data is stored in memory and how it can be accessed using arrays.
@brandoncarris9015
@brandoncarris9015 4 ай бұрын
1:05:52 insane 180 dap
@WizeChoice
@WizeChoice 8 ай бұрын
Amazing 👉🏾✨✨✨
@姚景曦
@姚景曦 4 ай бұрын
As a college student, I thought it is a well designed course for cs learning.
@srijanraghavula
@srijanraghavula 5 ай бұрын
The volunteers are increasing in number as they see some incentives XD
@AsaAdetimirin
@AsaAdetimirin 2 ай бұрын
Total Recall (gene) ACTIVE ✅☑️💪🏾
@blavikensbutcher
@blavikensbutcher 6 ай бұрын
Now I want to be born again and go to Harvard
@PerceyIchorre
@PerceyIchorre 9 күн бұрын
why do you have to be christian to go to Harvard?
@ReddXYZ
@ReddXYZ Ай бұрын
Me: I don't like the sorting algorithm music. David: ...You would if you had robot ears...
@smsony36
@smsony36 5 ай бұрын
i think i love number 3.
@CordovaHGS
@CordovaHGS 7 ай бұрын
I was not provided brownies, who can I speak to about rectifying this issue????
@littlebrotha123
@littlebrotha123 5 ай бұрын
He just gave us John Harvard's number. I am going to leave him an angry voicemail
@notrps
@notrps 5 ай бұрын
@@littlebrotha123 yeah! 👍
@MuhammadMekaeylBinFaisal
@MuhammadMekaeylBinFaisal 3 ай бұрын
@@littlebrotha123 does it work?
@GilbertoGalindez-y8x
@GilbertoGalindez-y8x 5 ай бұрын
I'm in love with Sam button ❤
@PerceyIchorre
@PerceyIchorre 9 күн бұрын
we all are bro, shes the official math major mascot
@not_amanullah
@not_amanullah 9 ай бұрын
Understood++
@ex4787
@ex4787 5 ай бұрын
Can really see Professor Malan sweat in 4k, lol. But to be less mean, I'm loving this course!
@OfficialCodeVoyage
@OfficialCodeVoyage 10 ай бұрын
*Merge Sort is Overpowered !*
@veronicasmemories
@veronicasmemories 7 ай бұрын
Omg ✨spoiler alert ✨
@bilalshaikh6603
@bilalshaikh6603 7 ай бұрын
Bogo sort is best
@dheerajnihalani2430
@dheerajnihalani2430 2 ай бұрын
20:20 Sam trying to help him, but was the wrong box
@imcalled_ali
@imcalled_ali 8 ай бұрын
amazing!
@dglesterhardunkichud4287
@dglesterhardunkichud4287 8 ай бұрын
Is anyone else confused about what the lights in the front of the stage say in binary, or did I just mess something up/miss something?
@PhoebeX822
@PhoebeX822 2 ай бұрын
I really love this course and appreciate all the efforts that’s gone into it!!!! However, I’m a bit confused about the calculations for Selection Sort and Bubble Sort. From what I understand, both should follow the formula: (n - 1) + (n -2) + ... +1 = n^2/2 +n/2; even if Bubble sort is (n-1)^2, Selection Sort is generally more efficient when n > 2. Only in the best-case scenario, where the numbers are already in order, does Bubble Sort achieve O(n), which is better than Selection Sort’s O(n^2). Could someone clarify this for me? I'm feeling so confused. Thanks in advance!
@victorfds
@victorfds 9 ай бұрын
Amazing!!!! 🥇
@anukritis1297
@anukritis1297 7 ай бұрын
The course is awesome.Have reached lecture 3. But I am unable to understand recursion program. I get the theory but not exactly how we are getting the pyramid. If draw(n-1) is implementing value of n should reduce yet on printing value of n instead of # output is 1 22 333 How??????
@ZiBlogg
@ZiBlogg 26 күн бұрын
I'm pretty sure you have already got to understand it, but I will explain it the way I understood it anyway in case someone else has the same remark (And good comment btw, I just glanced over the notion, thanks to you I actually tried to understand it by visualizing the process in my head). Since the function starts with a call to the function itself, in this case draw(n-1), for the sake of clarity let's assign n = 5, draw(5) will call draw(5-1) = draw(4) which will call draw(4-1) = draw(3) which will call draw(3-1) .... all the way to draw(1), since draw(1-1) is 0 and we have an if statement that stops 0 from going negative. at draw(1) IS when the for loop actually starts, draw(1) will print ( *for( i = 0; i < 1; i++)* ) the first line of hashes which has n=1, THEN going back to draw(2) and printing ( *for( i = 0; i < 2; i++)* ) the second row of hashes, all the way back to the original draw(5) which will print the last row of hashes aka n=5.
@danylokarpenko4943
@danylokarpenko4943 3 ай бұрын
the best CS education content on the Internet shores. THANKS! I wish I could be there in the University to study all the topics during the year 🥲
@not_amanullah
@not_amanullah 9 ай бұрын
Thanks
@markmarki9511
@markmarki9511 6 ай бұрын
15:41 Sam didn't get her high five 😢
@john9908
@john9908 Ай бұрын
She was cringe
@Amauryzau
@Amauryzau 2 ай бұрын
1:33:00 (Recursion section) Why is the if ( n
@morpitz7188
@morpitz7188 Ай бұрын
do you still need help?
@harshpareta-o6o
@harshpareta-o6o Ай бұрын
Cheers
@oanhtuan2408
@oanhtuan2408 7 ай бұрын
Amazing 🎉 Wow😮
@dheerajnihalani2430
@dheerajnihalani2430 2 ай бұрын
Just provide a AC in the room, poor david
@sci-tech3916
@sci-tech3916 11 ай бұрын
38:06
@PerceyIchorre
@PerceyIchorre 9 күн бұрын
honestly id probably try lockers at random until i found the right one, but what is random?
@anhau7981
@anhau7981 3 ай бұрын
her enery make me want to learn CS50 - lecture 3
@dockwater
@dockwater 5 ай бұрын
Somewhere around 1:20:00 a discrepancy between the video and sound begins
@x3nomat
@x3nomat 6 ай бұрын
I don't understand how the Draw function ever draws anything, because it calls itself in the beginning and then returns when reaching 0... :/ How does it ever get to the for loop?
@littlebrotha123
@littlebrotha123 5 ай бұрын
i was wondering that myself but then i thought about it some more and i think this is what happens. first call to draw calls second call which calls third which calls fourth all the way until n reaches zero and no more calls are made. up to here, when the last call is called, no printing has taken place, but since no more calls are going to be made it begins cascading backwards from the last call, say the 9th call is the last -- the 9th call then prints first (the single block), then the 8th call prints (two blocks), then the 7th and 6th and so on until it cascades or collapses back down to the first call which will then be the last to print 9 blocks.
@ellieu177
@ellieu177 5 ай бұрын
I was confused about the same thing! I asked DDB and apparently in this case 'return' doesn't exit the outer 'draw' programme yet, because the draw functions are all in a 'stack' at that point waiting to execute (from draw(1) because it was called most recently, upwards.) So return stops 'draw(n-1)' being called again, but all of the draw functions waiting will still execute. I hope that helps!
@duanepoettcker5544
@duanepoettcker5544 8 ай бұрын
I'm always amazed at how fast he types. Then I remember I'm watching it at 1.5x speed. (still pretty fast though)
@ombanerjee2623
@ombanerjee2623 7 ай бұрын
finished 17/04/2024, the day before my kcet exam
@Giac_of_all_trades
@Giac_of_all_trades 5 ай бұрын
1:13:01 Al Pacino moment
@sathishp3180
@sathishp3180 11 ай бұрын
1:22:47
@krishBhardwaj-xz2hl
@krishBhardwaj-xz2hl Күн бұрын
did the guy in the front raised his hand for a question at 28:22 probably David couldn't see him
@BestHomeOman
@BestHomeOman 19 күн бұрын
11:00 ARRAY
@paolobalestriere1201
@paolobalestriere1201 5 ай бұрын
At 28:25 there was a student that would wanted to ask a question 😭
@jamesbrock7908
@jamesbrock7908 7 ай бұрын
Tipe for tideman: watch next lecture to learn how to swap values
@serfraserfraz
@serfraserfraz 4 ай бұрын
0 fits perfect
@Bilou-Otaku
@Bilou-Otaku 2 ай бұрын
Sam is soooo cuteeee ✨✨💫💫✨⭐⭐
@valenbozaa
@valenbozaa 5 ай бұрын
I want to be the girl on the front that always raises her hand when david makes a question
@muhammadzeeshan3911
@muhammadzeeshan3911 8 ай бұрын
In merge sort if the length of list is in odd number how can we make 2 equal sections or how can we divide list in two equal lengths please reply
@Magicninja01
@Magicninja01 7 ай бұрын
The halfs dont have to be equal. If its an odd number, one half will be 1 higer than the second
@badguy7432
@badguy7432 5 ай бұрын
the type is of int genre, in this level of cs. So, when you divide an odd number by half, it will auto omit the float (everything beyond the "."). So, mid index will be this value that has float omitted, left_half is from 0 to mid, right_half is from mid to n-1
@hsglator7135
@hsglator7135 5 ай бұрын
I really don't know what to say but I can do this instead while (true) { printf ("❤️") ; }
@bi4d
@bi4d 4 ай бұрын
Woah, u went from week 3 to 6 in only 2 days?
@hsglator7135
@hsglator7135 4 ай бұрын
@@bi4d Yeah, but I was just watching and taking notes. By the sixth week, I realized there were also problem sets. 🥲
@programmingguy6081
@programmingguy6081 5 ай бұрын
I must be missing something Prof. Since when did the C programming language get a 'string' data type? I believe C++, Objective C, and C# all have a string data type but I don't know of a version of C with a string type at least not as a base primitive type. Is this a user defined type that is part of the cs50.h header? Your editor is treating the string word as a known type. Note to students outside this class room none of the code that the Prof presents with the string data type will work in a pure C compiler. The code may work in a C++ compiler.
@Bloorp425
@Bloorp425 5 ай бұрын
it is defined in cs50.h...it is typedef char *string under the hood... I think
@luckyb0132
@luckyb0132 2 ай бұрын
It's part of their own header. You need to use it for the problem sets. He talks about in in the previous lecture
@PhysicsMalolan-cu8ft
@PhysicsMalolan-cu8ft 3 ай бұрын
Why was the selection sort algorithm quicker than bubble sort at the end? Any reasons for it since both have O(N^2)?
@sandipanjha3
@sandipanjha3 2 ай бұрын
More swapping. Just take an example of 4 integers and see how many swaps you need in each case
CS50x 2024 - Lecture 4 - Memory
2:17:23
CS50
Рет қаралды 305 М.
3 Types of Algorithms Every Programmer Needs to Know
13:12
ForrestKnight
Рет қаралды 501 М.
Why no RONALDO?! 🤔⚽️
00:28
Celine Dept
Рет қаралды 90 МЛН
Thank you Santa
00:13
Nadir Show
Рет қаралды 39 МЛН
I thought one thing and the truth is something else 😂
00:34
عائلة ابو رعد Abo Raad family
Рет қаралды 10 МЛН
Computer Scientist Answers Computer Questions From Twitter
14:27
FAS Generative AI Faculty Show & Tell: Prof. David Malan, "Using CS50's AI-based Software"
15:32
Harvard Faculty of Arts and Sciences
Рет қаралды 6 М.
CS50 Fall 2024 - Lecture 3 - Algorithms (live, unedited)
2:32:40
Is C BETTER than C++ for beginners? // Code Review
31:16
The Cherno
Рет қаралды 58 М.
CS50x 2024 - Lecture 5 - Data Structures
2:02:49
CS50
Рет қаралды 417 М.
*Next-door 10x Software Engineer* [FULL]
4:50
Programmers are also human
Рет қаралды 797 М.
CS50x 2024 - Lecture 2 - Arrays
2:12:04
CS50
Рет қаралды 478 М.
10 Math Concepts for Programmers
9:32
Fireship
Рет қаралды 1,9 МЛН