1 / 14

Section: Pset5

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.

zoe-diaz
Télécharger la présentation

Section: Pset5

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS50 Section: Pset5 Jordan Jozwiak

  2. 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

  3. This Week • Brief Feedback/Questions for Pset4 • Section of Questions (and brief discussion with slides) • Stack (~10 min) • Queue (~10 min) • Singly Linked lists (~50 min) • If time… • Hash tables

  4. Pset4 Feedback • bf.bfSize vs. bi.biSizeImage • bf.bfOffBits • uint8_t, uint32_t, int32_t, and uint16_t • Junk data in an image – image appears the same but it has a larger file size? How?

  5. Does your TF try too hard? Forensics 2011 Forensics 2012

  6. Stacks • Last in, first out data structure. • Can ‘pop’ or ‘push’ things to the top of the stack. Top

  7. Queues • First in, first out data structure. • “Insert” and “Remove” operations. Head Tail

  8. Linked Lists • Data structure composed of a set of structs. • Each struct contains a piece of data and a pointer to the next struct. struct node *next int num typedefstruct node { int num; struct node *next; } node; 42 50 null struct node

  9. Linked Lists • Unlike an array, linked lists allow us to insert or remove elements in constant time! 42 50 NULL 35

  10. Hash Tables • Consists 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.

  11. Hash Tables Good Hash Functions are: • Deterministic • Uniformly distributed int xkcd_hash(char *word) { return 4; } THIS IS BAD

  12. Hash Tables: with Linked Lists

  13. Coding time!!! • stack.c(~10 min) • queue.c(~10 min) • sll.c(~50 min) • Get the code… • cd ~/Dropbox • wgethttp://cdn.cs50.net/2012/fall/sections/6/section6.zip • unzip section6.zip

  14. 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/

More Related