@@friedrichmyers *shrug* everyone has different learning styles, I don't replay the whole lecture, but I do like to replay a portion while I'm watching to make sure I can logically follow a concept before moving on to the next
I've watched CS50 2023 to get started with some concepts of CS and now cmoe back to 2024 from time to time to see David explainging some specifiec concepts when I bump into them when solving problems. Really honored to have David, CS50 series and the team. Many thanks.
@@Rodrigo_Pimenta You'll receive a certificate at the end... A certificate that carries significant weight. CS50 is one of the top online courses for an introduction to CS.
I already know these concepts still learned alot from the lecture, for those who are confused and do not understand the concepts take time to grab these concepts, watching the lecture in one sitting can be overwhelming, believe me this is the best as it gets in terms of explaination.
@@freelance-writer i also feel like it's hard to think about the questions at that pace. for me at least, it takes me running through a specific section a few times before understanding it enough to even form a good question
i hope youre not just talking about cs50x because it has like 11 lectures in total so almost every lecture is in your top 10 most difficult lesson haha
This was such a wondeful course. Well put and in very simple terms. If you already have a descent understanding of DSA and some C, it's going to be flawlessly easy to pull through the course.
@@bassycounter Late answer here but I think it's because this is one of the hardest part of the CS50 course, if you get past this block then you'll be very likely to finish the whole course. Some people unfortunately give up at week 4 or week 5.
@@lintz_lin oh okay, makes sense. I find it very interesting and refuse to give up until I finish, just turned in week 9 and about start final project once i get everything properly setup locally. Wishing the best of luck and good vibes to everybody else!
take breaks, at most after one hour but you have to walk away from the computer, headphones, etc literally unplug. On my longest day, I took a two hour break and enjoyed the weather outside before resuming and it and when I resumed it was very simple
@@4olufade bro pls tellme i am gonna go to college and i dont know how to code and i am feeling left behind my peers some of them! pls tell me if i watch this in 2x and complete all the lectures in 2 days and the complete all the home work in 10-15 days will it be a good strategy to complete this course fast? as i wanna also take cs50 ai w etc. pls tell
@@adwaitjog4571you’d be better off taking your time so you can absorb the information and get a better foundation. Stop comparing yourselves to others everyone learns at a different pace. But if you still want to try to rush through it do so knowing that you’ll likely miss out on important fundamentals. I’m in the same boat as you basically but i’m just taking my time. Good luck though bro
This is ALL pretty crazy in terms of low-level languages like C. And makes you wonder how anything actually got accomplished in the good old days. They no doubt wasted a lot of time on just simple stuff. The equivalent would be of someone wanting to go to the grocery store. But wait... Oh ya, that's right, first I have to build the car, LOL Thank god for high-level languages.
@@twincherries6698To be honest, it's a bit complicated, if you ask me. When C first came out it was considered high-level compared to other languages. Now the reverse can be argued. And I've even heard it being called a middle-level language, if you can believe it.
To an extent. If you want to compare C with Python and JavaScript, C is a Ferrari and the others are Fords. You may be able to build things quickly with Python and JS, but the manual things one needs to do in C, along with C being one iteration away from machine code, makes it the fastest and most precise language in existence. it doesn’t arbitrarily assign memory like Python or leak like JavaScript and it doesn’t carry and pass around huge pieces of data to other functions/etc.
I think you got confused on what level means here. The lower the level of the language, the more control it gives you over hardware (the lowest you go before straight up binary is assembly). Higher level abstracts it all away (kinda like python for example). High level doesnt mean complicated here. Ironically its quite the opposite lol.
Loved how they showed malloc using balloons and pointing it with threads for showing pointers and pictured the whole linked list. Thank you CS50. These activities are super helpful.
Update: finally submitted the final week 5 problem more than a month later. Hardest week so far for me by a lot, but getting this far has taken me 9 months to do 5 weeks of problems. Don't give up!
@@andoryu14 Well done! Speller was certainly a tricky one, I’m not even sure if I’d be able to easily redo it if I were to try it again, but to be fair, a lot of these problem sets are really hard to FULLY digest within only a week, they’re mostly just things you get better at by repeating over time to get more comfortable with. Just a few more weeks to go! The stuff with Python is a breath of fresh air, I just got to the final project about a week ago, still haven’t made much progress with it if I’m being honest since everything is coming from scratch and I’m having trouble with planning out how I want everything to look and work, but I think you’ll like the next few weeks, especially the week with SQL, that was a fun problem set.
The idea of a database that expands exponentially as you add things to it is hilarious to me. "Congratualtions, fellow scientists, we've put our heads together and come up with an algorithm that always takes constant time to search... Now there's almost no practical scenarios where we could use it, but it's cool, right?"
Restarted cs50x , didnt rlly understand it. I was watching until week 8 and decided to retry bc I was struggling to keep up and understand. But now Im getting better at it!
This lecture is particularly hard for me to understand. I've watched it two times and i am currently watching the "linked list" part the 4th time. Just now, i begin to understand the implementation.
i just watch about 15 minutes at a time still i have no idea what i was watching and want to sleep right away . but that not the worst part. the worst part is i even dream about this lecture and still have no idea after i woke up 🥵
1:45:01 can't you just have an array a-z then each letter a-z points to another array a-z and so on until u reach the amount of letters you need?? edit: nvm they get there oops lol edit2: oml I LOVE TRIES, GIVE ME INFINITE STORAGE CUZ ITS ALL I WANNA USE
I think we can insert element in linkedlist at last with O(1) instead of o(n) by storing the last inserted node pointer in outer scope. Correct me if i am wrong.
Interesting how David doesn't stop and ask if there's any questions during this whole lecture, like he did for every previous lecture...hmm, I wonder why 🤔..
Is it only me who thought this lecture was so much harder than all the previous ones?? I am struggling here just comprehending the lecture here compared to all of the previous ones and its so annoying & confusing. I pray that i am not alone in this lmao
i had a ques at 1:04:25 , when u entered at the terminal 1 2 3, you are also entering spacebars ( ) which cant be converted to integers, so why no error?
hi! spaces in your shell(terminal) are used to separate arguments, so the program doesnt even receive those spacebars. so, argv is just [1,2,3] instead of [1, "", 2, "", 3].
1:49:40 I don't really think that is making it better, if you wanted to make sure you only get positive values I guess you could put in an if statement that raises an error or something like that. This way, you just convert negative numbers to positive numbers, which could lead to you trying to access garbage values. This seems much harder to debug to me.
Atoi was introduced in problem sets, probably in week 3 as i remember because i used it myself before week 5. In general problem sets requires sometimes more than just watching the lecture
@@tonyvenice5252 Yes, the problem sets are on the OpenCourseWare website linked in the description. Additionally, there is supplemental information, including notes, the source code written in the lectures, seminars, additional practice problems (meant to be solved after the problem sets), and other videos (called "Shorts" and "Sections").
First of all great efforts and brilliant content! That said, I am always fascinated with how educators can make simple concepts sound like they are talking statistical mechanics or some sophisticated topic! I am not sure if the impact is to keep students alerted or the average students will be thinking ooh this is so sophisticated and result in anxiety! not sure! but what I am sure of is that these are pretty average logical informational topics like most of computer science subjects and they don't require all this excitation!
Well in my opinion this excitement and playfull approach is one of the best ways to keep the students concentrated and interested. Excitement is not required but it makes the lecture so much more interesting. You could say the same thing about every subject in school. Compared to your knowledge almost everything is "average". However, it is not to the students! So please rethink your opinion and try to avoid calling information "average".
the implementation of self-referential code in low level mechanics is not "average informational topics." I have to imagine the enthusiasm helps people learn.
In the implementation code of a linked list, when creating a linked list of size 1, is it acceptable to malloc directly into 'list' without declaring a new variable n?
8:02 It's misleading to use method names _push_ and _pop_ because those are the typical functions for an array. During which the more cpu-intensive operations of shrinking and expanding the physical size/length of an array is committed. The _get()_ and _put()_ methods more accurately imply that cells/elements within the queue are _overwritten_ or non-destructively _read_ as per index values updated within _head_ and _tail_ integer variables. While the size/length of the array remains fixed according to a _CAPACITY_ value.
28:30 do we now have TWO pointers pounting at the same chunk of memory (1,2,3,4)? Edit: I thought free-ing list also "destroyed " it's pointer, so the 8 bytes of the pointer could also be reused?? No? ○.●
not quite, both of the pointers point to the address of the memory of the first element, in this case the memory address of 1. every element in this case is 4 bytes (int is 32 bits). when allocating memory for list you are telling the operating system to reserve a chunk of memory for it, this can be seen as metadata in the heap of the program (which also tells you if it's a valid memory allocation), so when you free() list you are telling the operating system that that memory is now available for use, so it becomes invalid memory for the program (list still is pointing to the same memory address, but it's "dangerous" to access it since it's not memory for the program. list becomes a dangling pointer and it's a good practice to make it point to NULL after freeing it, that way you don't point to memory out of the program's scope.
DACH TN -- Oriental already! Public -- influence -- felony - by machine! No way -- they be in, that large -- open area! On any -- Campus! Law -- already, "Don't allow!"
1:13:56 im confused. Dont you get a garbage value as n->next then since you dont set it to null? If so it leaves you without a null to terminate the list... wont it just keep iterating over and over again appending garbage till it runs out of memory?
line 32, every new node's next is set to NULL. so when you reach the last element of the linked list, you make this new element of the list to point to the new node who in turn points to NULL
hi, at the time line 27.57, do we need to free temp also,, line no 29-free(list); ,line no 30- list = tmp; here list has been assigned with tmp, line 31- as per my thoughts - free(tmp);
I believe at that point 'list' now points to the memory that was allocated to 'tmp', as he set 'list = tmp' on line 30, so 'free(list)' on line 37 is basically free-ing the memory that was once allocated to tmp. I'm still learning this myself so if that's incorrect please correct me :)
heyy you should not free the tmp, it will cause an undefined error, as long as you reassigned it back to list, the pointer(tmp) itself was carried with it to list
Just finished watching lecture 5. Now it's time to watch it again like 3 more times. :D
Not too watch it for the 2nd time in a second 😂
No. Just watch it once and practice
I thought it was only me who do this
😀
@@friedrichmyers *shrug* everyone has different learning styles, I don't replay the whole lecture, but I do like to replay a portion while I'm watching to make sure I can logically follow a concept before moving on to the next
@@ex4787 Just fuck off. I don't want to argue.
I've watched CS50 2023 to get started with some concepts of CS and now cmoe back to 2024 from time to time to see David explainging some specifiec concepts when I bump into them when solving problems. Really honored to have David, CS50 series and the team. Many thanks.
As a seasoned developer, I use these videos to augment my son's curriculum. This is invaluable knowledge laid out in a clear and compelling way.
Can you elaborate? Why is it valuable to say on your curriculum that you whached the CS50 online course?
@@Rodrigo_Pimenta You'll receive a certificate at the end... A certificate that carries significant weight. CS50 is one of the top online courses for an introduction to CS.
Is there any Python DSA course U can recommend
@@anshuraj4277 there's a CS50P python class if you're interested.
I already know these concepts still learned alot from the lecture, for those who are confused and do not understand the concepts take time to grab these concepts, watching the lecture in one sitting can be overwhelming, believe me this is the best as it gets in terms of explaination.
Yeah, when he asks "So, any questions?", I'm surprised that a hundred hands don't go up. 😆
@@freelance-writer i also feel like it's hard to think about the questions at that pace. for me at least, it takes me running through a specific section a few times before understanding it enough to even form a good question
@@meer4h I take notes and follow in VS Code while watching, so a 2-hour lecture lasts about 4-5 hours. :)
@@freelance-writer I think people still don't understand enough to ask questions.
This lesson and that one before are in my top 10 most difficult lessons of this CS50😅
i hope youre not just talking about cs50x because it has like 11 lectures in total so almost every lecture is in your top 10 most difficult lesson haha
@@abdullahfarooq4770
Great logic
@@abdullahfarooq4770 Algorithms, Memory and Data structures are the hardest in CS50X everything else is easier.
@@Hellmiauz yeah I completed cs50
This week was the hardest 😭
This was such a wondeful course. Well put and in very simple terms. If you already have a descent understanding of DSA and some C, it's going to be flawlessly easy to pull through the course.
This is it, the stumbling stone of CS50🎉🎉🎉
Fr 💀
What exactly do you mean by “stumbling”
@@villagerdude2989all I see is everyone loves these lectures
@@bassycounter Late answer here but I think it's because this is one of the hardest part of the CS50 course, if you get past this block then you'll be very likely to finish the whole course. Some people unfortunately give up at week 4 or week 5.
@@lintz_lin oh okay, makes sense. I find it very interesting and refuse to give up until I finish, just turned in week 9 and about start final project once i get everything properly setup locally. Wishing the best of luck and good vibes to everybody else!
This is the first time I took an English online course and it’s simply great.
I’m short of words. Thank you cs50 staff🙏🏽
Intro music is a banger!!! Whoever composed it, hatsoff!
indeed
cn i sample this shii?!
String s = "And when everybody is super...no one will be";
@@Bacinator334 char *s 😭
@@abbashussayn bro. Go to the library.
This man is doing more work than the hardwares.
Happy New Year and all the best for 2024 ! Happy Coding 😃
شكرا ديفيد واخيرا خلصت الاسبوع الطويل هذا وبالتوفيق للجميع
I'm at a point where I don't even understand what it is I don't understand.
just stop and watch some other video about it then come back
@@lamy1057that's what I do 😁
take breaks, at most after one hour but you have to walk away from the computer, headphones, etc literally unplug. On my longest day, I took a two hour break and enjoyed the weather outside before resuming and it and when I resumed it was very simple
@@4olufade bro pls tellme i am gonna go to college and i dont know how to code and i am feeling left behind my peers some of them! pls tell me if i watch this in 2x and complete all the lectures in 2 days and the complete all the home work in 10-15 days will it be a good strategy to complete this course fast? as i wanna also take cs50 ai w etc. pls tell
@@adwaitjog4571you’d be better off taking your time so you can absorb the information and get a better foundation. Stop comparing yourselves to others everyone learns at a different pace. But if you still want to try to rush through it do so knowing that you’ll likely miss out on important fundamentals. I’m in the same boat as you basically but i’m just taking my time. Good luck though bro
I love cs50 and David
This is ALL pretty crazy in terms of low-level languages like C. And makes you wonder how anything actually got accomplished in the good old days. They no doubt wasted a lot of time on just simple stuff.
The equivalent would be of someone wanting to go to the grocery store. But wait... Oh ya, that's right, first I have to build the car, LOL
Thank god for high-level languages.
LOL😅
Isn't C a high level language
@@twincherries6698To be honest, it's a bit complicated, if you ask me.
When C first came out it was considered high-level compared to other languages. Now the reverse can be argued. And I've even heard it being called a middle-level language, if you can believe it.
To an extent. If you want to compare C with Python and JavaScript, C is a Ferrari and the others are Fords. You may be able to build things quickly with Python and JS, but the manual things one needs to do in C, along with C being one iteration away from machine code, makes it the fastest and most precise language in existence. it doesn’t arbitrarily assign memory like Python or leak like JavaScript and it doesn’t carry and pass around huge pieces of data to other functions/etc.
I think you got confused on what level means here. The lower the level of the language, the more control it gives you over hardware (the lowest you go before straight up binary is assembly). Higher level abstracts it all away (kinda like python for example). High level doesnt mean complicated here. Ironically its quite the opposite lol.
We’re back again with this hellish week 😂
Loved how they showed malloc using balloons and pointing it with threads for showing pointers and pictured the whole linked list. Thank you CS50. These activities are super helpful.
tbh this is one of the most difficult lectures i ever witnessed in my life
Thank you sir for explaining it in such a simplified way, respect.
I loved the balloons explanation Mr. David
I recall people saying week 3 or 4 were the hardest, but this week has really deflated my sails and I'm not even at the pset yet
this one is giving me a headache trying to understand pointer arithmetic. I now see why people call C an archaic language if you're new
Yall got this!! Just keep watching lectures and sessions and read the notes if needed.
Update: finally submitted the final week 5 problem more than a month later. Hardest week so far for me by a lot, but getting this far has taken me 9 months to do 5 weeks of problems. Don't give up!
@@andoryu14 Well done! Speller was certainly a tricky one, I’m not even sure if I’d be able to easily redo it if I were to try it again, but to be fair, a lot of these problem sets are really hard to FULLY digest within only a week, they’re mostly just things you get better at by repeating over time to get more comfortable with. Just a few more weeks to go! The stuff with Python is a breath of fresh air, I just got to the final project about a week ago, still haven’t made much progress with it if I’m being honest since everything is coming from scratch and I’m having trouble with planning out how I want everything to look and work, but I think you’ll like the next few weeks, especially the week with SQL, that was a fun problem set.
@@andoryu14 Cool bro I just finished week 4, wish me luck
Top quality demonstration .
Today I feel like Penny trying to study physics with Sheldon Cooper
i started watching, this on monday...and it is wednesday, when i finally got something😂😂
@@rishavjain5087 same friend, same
Dave has done more than 90% of profs out there. respect.
Again great way of explaining all these concepts! Very good examples, a pleasure to watch :)
finally finish this video! keep going guys!
brain *my_brain = malloc(sizeof(lecture5));
>segmentation fault
lovely geek humor.
@@ProgrammerPenguin i remembered my brain got fried watching this lecture
@@themintroid i finished the week, im on week 7 but i just wanted to rewatch it.
@@ProgrammerPenguin good luck! week 7 pset is fun
@@themintroid how far have you gotten?
Where was this when i needed it 😭
Truly very simplified approach
oh my goodness, i find this part so difficult. i have to rewatch weeks 4 and 5.
me too
Understand the problem sets, those will help you more
The idea of a database that expands exponentially as you add things to it is hilarious to me. "Congratualtions, fellow scientists, we've put our heads together and come up with an algorithm that always takes constant time to search... Now there's almost no practical scenarios where we could use it, but it's cool, right?"
I love the linked list demo
Restarted cs50x , didnt rlly understand it. I was watching until week 8 and decided to retry bc I was struggling to keep up and understand. But now Im getting better at it!
Welcome back!
Good job👍
I was just can't stop listening it, Wow
It suddenly started making a lot more sense.
MY BRAIN EXPLODED.
if you code the middle of the list scenario before the end of the list in linked lists, make sure n->next != NULL in the IF statement
The ballon stuff was lighthearted and cool 🤣🤣🤣. Thanks for that Scully and David
Amazing explanation of hash table
You gotta watch shorts with these man
"I have no idea what im studying" lol
yeah! i have noticed. lol😂😂
he's paying thousands for that box of cookies
And he is enrolled in Harvard 🤣🤣
I really want a delicious cookie break and stress ball
can't wait to start week 6 and get to python)
1:15:00, I think if node's number is equal, '=' can be add at line62 or line41.
gonna make a pointer named gun and point it to my fkn brainnnnnn
So Amazing 👉🏾✨✨✨
I like how well the lecture was prepared: handing out cookies to demo FIFO
This lecture is particularly hard for me to understand. I've watched it two times and i am currently watching the "linked list" part the 4th time. Just now, i begin to understand the implementation.
Dont give up bro, we've all been there
I thought I was the only one struggling with the linked list section. My brain was getting fried. difficult to keep up TT
i wish universities of this quality were in africa, india and other underdeveloped countries. the world would have been so much better then.
India already have IIT
@@unknown-nr9qs awful quality
The only thing more difficult than this course is being born poor in Brazil. So I think I can handle it.
i just watch about 15 minutes at a time still i have no idea what i was watching and want to sleep right away . but that not the worst part. the worst part is i even dream about this lecture and still have no idea after i woke up 🥵
This dude is still losing sleep over how the balloon demonstration went but to me it seemed to go just fine 🤷♂
1:21:27 英文字幕裡的[INAUDIBLE],因該是mario,馬力歐,前幾堂課舉的例子。
S/o to Harvard
I missed the ending line, “This was CS50”
1:45:01 can't you just have an array a-z then each letter a-z points to another array a-z and so on until u reach the amount of letters you need??
edit: nvm they get there oops lol
edit2: oml I LOVE TRIES, GIVE ME INFINITE STORAGE CUZ ITS ALL I WANNA USE
Ok, thank you C, we're moving to your modern child, Python!
lmao!
6:00 so relatable
even tough he is explainging in such a goood way don't know why i am not able to understand it
I think he's a tad bit too animated. gotta weed through his fluff to get to the actual message he's trying to convey
Thanks
i am glad he is using c language
He earned my respect when he pronounced valgrind "val grinned"
makes me think of norse mythology
Thank you for sharing this online. Time to fix my knowledge gaps.
how are you verified???
why are you verified?
I liked the balloons demonstration!
I think we can insert element in linkedlist at last with O(1) instead of o(n) by storing the last inserted node pointer in outer scope. Correct me if i am wrong.
yes last node is commonly stored as well in linked list implementations
Today is my exam, wish me luck 🤞
Yes bro good good exams. 😎
I have an exam coming up hope this helps
I didn't even notice until now, that David Malan is wearing the same thing all the time 😅
wow !!
21:26 Whenever using malloc or whenever using pointers?
Well! That was something.
Interesting how David doesn't stop and ask if there's any questions during this whole lecture, like he did for every previous lecture...hmm, I wonder why 🤔..
I guarante you nobody who is first hearing this class have a fukin clue of wtf is goin on.
Raise your hand if you choked up on linked lists 🤚
Dang, Scully was quite expressive with her body language. I wonder if she is a professional mime.
so nice :) ty
Is it only me who thought this lecture was so much harder than all the previous ones?? I am struggling here just comprehending the lecture here compared to all of the previous ones and its so annoying & confusing. I pray that i am not alone in this lmao
Lecture 5 indeed tends to be the most challenging!
@@davidjmalan Great to hear that im not alone and that it should get at least a bit easier! Really appreciate the reply, thanks :)
Actually this lecture has challenged me for sure, coz am trying my level best but awww things are really tough in this week 5
I started to feel like that "No pun intended." is intended.
I think that these lectures are not for beginners as a beginner. Do you agree with me,guys ??? ❤❤❤
This is super complicated for me ngl.
👍👍👍
i had a ques at 1:04:25 , when u entered at the terminal 1 2 3, you are also entering spacebars ( ) which cant be converted to integers, so why no error?
hi! spaces in your shell(terminal) are used to separate arguments, so the program doesnt even receive those spacebars. so, argv is just [1,2,3] instead of [1, "", 2, "", 3].
@@mathesukk okk thanks a lot
1:49:40 I don't really think that is making it better, if you wanted to make sure you only get positive values I guess you could put in an if statement that raises an error or something like that. This way, you just convert negative numbers to positive numbers, which could lead to you trying to access garbage values. This seems much harder to debug to me.
look at it this way, if your hash function returns a negative value and that value is used as an index in an array, it would raise an exception.
1:39:40
1:41:45
1:43:32
I wonder what he actually said in the live class instead of Lakitu
@@charlesabju907 I NEED ANSWERS
1:51:31 0.26 second slower made a guy at microsoft discover a backdoor so yea xD
my brain had a segementation fault 1:14:23
same xD
I guess every week atleast one person is traumatised and now came my turn
loved this course ❤🩹
57:50 Is it just me or atoi function was never introduced before in the lecture?
Atoi was introduced in problem sets, probably in week 3 as i remember because i used it myself before week 5. In general problem sets requires sometimes more than just watching the lecture
Yes I don't recall it either. @paikspord8358 what is problem sets ? Is it available to the general public ?
@@tonyvenice5252 Yes, the problem sets are on the OpenCourseWare website linked in the description. Additionally, there is supplemental information, including notes, the source code written in the lectures, seminars, additional practice problems (meant to be solved after the problem sets), and other videos (called "Shorts" and "Sections").
@@tonyvenice5252 Located in the OpenCourseWare website in the description.
@@tonyvenice5252 you can see it in the cs50 manual or c libraries
what if we have more than one person with the same name when we're using Tries?
First of all great efforts and brilliant content! That said, I am always fascinated with how educators can make simple concepts sound like they are talking statistical mechanics or some sophisticated topic! I am not sure if the impact is to keep students alerted or the average students will be thinking ooh this is so sophisticated and result in anxiety! not sure! but what I am sure of is that these are pretty average logical informational topics like most of computer science subjects and they don't require all this excitation!
they dont if youre chatgpt
Well in my opinion this excitement and playfull approach is one of the best ways to keep the students concentrated and interested. Excitement is not required but it makes the lecture so much more interesting.
You could say the same thing about every subject in school. Compared to your knowledge almost everything is "average". However, it is not to the students! So please rethink your opinion and try to avoid calling information "average".
the implementation of self-referential code in low level mechanics is not "average informational topics." I have to imagine the enthusiasm helps people learn.
In the implementation code of a linked list, when creating a linked list of size 1, is it acceptable to malloc directly into 'list' without declaring a new variable n?
keep the balloon demo
8:02 It's misleading to use method names _push_ and _pop_ because those are the typical functions for an array. During which the more cpu-intensive operations of shrinking and expanding the physical size/length of an array is committed. The _get()_ and _put()_ methods more accurately imply that cells/elements within the queue are _overwritten_ or non-destructively _read_ as per index values updated within _head_ and _tail_ integer variables. While the size/length of the array remains fixed according to a _CAPACITY_ value.
28:30 do we now have TWO pointers pounting at the same chunk of memory (1,2,3,4)?
Edit: I thought free-ing list also "destroyed " it's pointer, so the 8 bytes of the pointer could also be reused?? No? ○.●
not quite, both of the pointers point to the address of the memory of the first element, in this case the memory address of 1.
every element in this case is 4 bytes (int is 32 bits).
when allocating memory for list you are telling the operating system to reserve a chunk of memory for it, this can be seen as metadata in the heap of the program (which also tells you if it's a valid memory allocation), so when you free() list you are telling the operating system that that memory is now available for use, so it becomes invalid memory for the program (list still is pointing to the same memory address, but it's "dangerous" to access it since it's not memory for the program. list becomes a dangling pointer and it's a good practice to make it point to NULL after freeing it, that way you don't point to memory out of the program's scope.
Could anyone tell me what is the music at the beginning?
See soundcloud.com/cs50/cs50x-2024-original-soundtrack !
@@davidjmalan Thanks .Obliged for these awesome lectures
free(my brain )😮💨
forgot ;
@@cfchd10 return 1;
@@brijeshparmar3908 huh?
When LIFO doesn't gives you cookies, Laugh 😂🤣
or cry depending on which side of the spectrum you are on
1:08:00
DACH TN -- Oriental already! Public -- influence -- felony - by machine!
No way -- they be in, that large -- open area! On any -- Campus! Law -- already, "Don't allow!"
I had to ensure if Im watching this at 1.5x speed
1:13:56 im confused. Dont you get a garbage value as n->next then since you dont set it to null? If so it leaves you without a null to terminate the list... wont it just keep iterating over and over again appending garbage till it runs out of memory?
line 32, every new node's next is set to NULL. so when you reach the last element of the linked list, you make this new element of the list to point to the new node who in turn points to NULL
hi, at the time line 27.57, do we need to free temp also,, line no 29-free(list); ,line no 30- list = tmp; here list has been assigned with tmp, line 31- as per my thoughts - free(tmp);
I believe at that point 'list' now points to the memory that was allocated to 'tmp', as he set 'list = tmp' on line 30, so 'free(list)' on line 37 is basically free-ing the memory that was once allocated to tmp. I'm still learning this myself so if that's incorrect please correct me :)
heyy you should not free the tmp, it will cause an undefined error, as long as you reassigned it back to list, the pointer(tmp) itself was carried with it to list