section: pset5
DESCRIPTION
CS50. Section: Pset5. Jordan Jozwiak. Announcements. Pset4 will be returned by Tuesday night (but hopefully tonight!) If you haven’t already, pick up Quiz 0 at end of class! Don’t forget to add music to our coding playlist ! Link sent out via email last week. This Week. - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Section: Pset5](https://reader035.vdocuments.site/reader035/viewer/2022071718/56812b9b550346895d8fbee5/html5/thumbnails/1.jpg)
Section: Pset5Jordan Jozwiak
CS50
![Page 2: Section: Pset5](https://reader035.vdocuments.site/reader035/viewer/2022071718/56812b9b550346895d8fbee5/html5/thumbnails/2.jpg)
AnnouncementsPset4 will be returned by Tuesday night (but
hopefully tonight!)If you haven’t already, pick up Quiz 0 at end
of class!Don’t forget to add music to our
coding playlist!Link sent out via email last week
![Page 3: Section: Pset5](https://reader035.vdocuments.site/reader035/viewer/2022071718/56812b9b550346895d8fbee5/html5/thumbnails/3.jpg)
This WeekBrief Feedback/Questions for Pset4Section of Questions (and brief discussion
with slides)Stack (~10 min)Queue (~10 min)Singly Linked lists (~50 min)
If time…Hash tables
![Page 4: Section: Pset5](https://reader035.vdocuments.site/reader035/viewer/2022071718/56812b9b550346895d8fbee5/html5/thumbnails/4.jpg)
Pset4 Feedbackbf.bfSize vs. bi.biSizeImage
bf.bfOffBitsuint8_t, uint32_t, int32_t, and uint16_tJunk data in an image – image appears the
same but it has a larger file size? How?
![Page 5: Section: Pset5](https://reader035.vdocuments.site/reader035/viewer/2022071718/56812b9b550346895d8fbee5/html5/thumbnails/5.jpg)
Does your TF try too hard?Forensics 2011 Forensics 2012
![Page 6: Section: Pset5](https://reader035.vdocuments.site/reader035/viewer/2022071718/56812b9b550346895d8fbee5/html5/thumbnails/6.jpg)
Stacks
Last in, first out data structure.
Can ‘pop’ or ‘push’ things to the top of the stack.
Top
![Page 7: Section: Pset5](https://reader035.vdocuments.site/reader035/viewer/2022071718/56812b9b550346895d8fbee5/html5/thumbnails/7.jpg)
Queues
First in, first out data structure.
“Insert” and “Remove” operations.
Head Tail
![Page 8: Section: Pset5](https://reader035.vdocuments.site/reader035/viewer/2022071718/56812b9b550346895d8fbee5/html5/thumbnails/8.jpg)
Linked ListsData structure composed of a set of structs.Each struct contains a piece of data and a
pointer to the next struct.
42 50typedef struct node { int num; struct node *next;} node;
struct node
null
int numstruct node
*next
![Page 9: Section: Pset5](https://reader035.vdocuments.site/reader035/viewer/2022071718/56812b9b550346895d8fbee5/html5/thumbnails/9.jpg)
Linked ListsUnlike an array, linked lists allow us to insert
or remove elements in constant time!
42
35
50 NULL
![Page 10: Section: Pset5](https://reader035.vdocuments.site/reader035/viewer/2022071718/56812b9b550346895d8fbee5/html5/thumbnails/10.jpg)
Hash TablesConsists of an array and a hash function.Hash function maps input to an index in the
associated array.Allows us to check whether something is
contained in a data structure without checking through the entire thing.
![Page 11: Section: Pset5](https://reader035.vdocuments.site/reader035/viewer/2022071718/56812b9b550346895d8fbee5/html5/thumbnails/11.jpg)
Hash TablesGood Hash Functions are:DeterministicUniformly distributed
intxkcd_hash(char *word){ return 4;}
THIS IS
BAD
![Page 12: Section: Pset5](https://reader035.vdocuments.site/reader035/viewer/2022071718/56812b9b550346895d8fbee5/html5/thumbnails/12.jpg)
Hash Tables: with Linked Lists
![Page 13: Section: Pset5](https://reader035.vdocuments.site/reader035/viewer/2022071718/56812b9b550346895d8fbee5/html5/thumbnails/13.jpg)
Coding time!!!stack.c (~10 min)queue.c (~10 min)sll.c (~50 min)
Get the code…cd ~/Dropboxwget http://
cdn.cs50.net/2012/fall/sections/6/section6.zipunzip section6.zip
![Page 14: Section: Pset5](https://reader035.vdocuments.site/reader035/viewer/2022071718/56812b9b550346895d8fbee5/html5/thumbnails/14.jpg)
On your way out…Don’t forget about the BIG BOARD! (give it a
shot)Remember that you can access section
powerpoints and SOQ solutions at http://cloud.cs50.net/~jjozwiak/