Upgrade to Pro — share decks privately, control downloads, hide ads and more …

A Taste Of Data Structures

Avatar for Danielle Tucker Danielle Tucker
August 15, 2013
27

A Taste Of Data Structures

A brief overview of some common data structures. (Lightning Talk)

Avatar for Danielle Tucker

Danielle Tucker

August 15, 2013

Transcript

  1. Array Efficiency Random Element Access: O(1) Insert/Removal: O(n) Iteration: O(n)

    Good: Quick access Bad: Additions/ Deletions can be expensive Random Access Data Structure 0 1 2 3 4 5 6
  2. Linked List Good: Additions/Deletions can be quick Bad: Random Access

    can be slow Efficiency Random Element Access: O(n) Element Removal: O(1) Iteration: O(n) Sequential Access Data Structure http://splat.wisetome.com/node/147
  3. Hash Key is turned into a location in an array

    by using a hash function Keys are in no particular order Useful for: • Ruby for parameters • Fast searching O(1) (average) • Cashes
  4. Stacks and Queues Stack - FILO (first in last out)

    Useful for: • Undoing Operations • Syntax Checking Queues – FIFO (first in first out) Useful for: • Performing Searches on Tree • Ordering of Worker Jobs
  5. Trees Many different types B+ , Red/Black AVL, Binary, ...

    Random Access (Searching): usually better than O(n) Useful for: • Searchable Data !! • Routing Algorithms
  6. Sources l http://en.wikipedia.org/wiki/Hash_table http://rubysource.com/data-structures-big-o-and-you/ http://www.cs.cmu.edu/~adamchik/15-121/lectures/ http://en.wikipedia.org/wiki/Tree_(data_structure) Further Reading: http://i.stack.imgur.com/HNMy4.png http://www.brpreiss.com/books/opus8/

    http://w3.cs.jmu.edu/spragunr/CS240/ConciseNotes.pdf Images: http://xkcd.com/722/ http://theverybesttop10.com/2013/02/16/images-of-cats-in-boxes/ http://checkitout9861.tumblr.com/post/29168735790/stack-ocats http://debsawsome.wordpress.com/tag/toilet-paper/ http://www.mobilemag.com/2010/07/30/apple-iphone-4-launches-in-canada/ http://splat.wisetome.com/node/147 http://www.pageinparis.com/2012/03/morocco-animals.html