data structures practice introduction to markov chaining
play

Data Structures Practice Introduction to Markov Chaining Checkout - PowerPoint PPT Presentation

Data Structures Practice Introduction to Markov Chaining Checkout DataStructures project from SVN Array List Linked List Stack Queue Set Map Implementations for all of these are provided by the Java Collections Framework


  1. Data Structures Practice Introduction to Markov Chaining Checkout DataStructures project from SVN

  2.  Array List  Linked List  Stack  Queue  Set  Map Implementations for all of these are provided by the Java Collections Framework in the java.util package.

  3. Op Operati ations ons Array List Linke nked d List Prov ovide ided Efficie cienc ncy Efficie cienc ncy Random access O(1) O(n) Add/remove item O(n) O(1) Q1,2

  4.  A last-in, first-out (LIFO) data structure  Real-world stacks ◦ Plate dispensers in the cafeteria ◦ Pancakes!  Some uses: ◦ Tracking paths through a maze ◦ Providing “unlimited undo” in an application Operati ations ons Efficie cienc ncy Implemented by Prov ovid ided Stack , LinkedList , and ArrayDeque in Push item O(1) Java Pop item O(1) Q3

  5.  A first-in, first-out (FIFO) data structure  Real-world queues ◦ Waiting line at the BMV ◦ Character on Star Trek TNG  Some uses: ◦ Scheduling access to shared resource (e.g., printer) Operati ations ons Efficie cienc ncy Prov ovid ided Implemented by Enqueue item O(1) LinkedList and ArrayDeque in Java Dequeue item O(1) Q4

  6.  Unorder rdered ed collections wi without t duplic icate ates  Real-world sets ◦ Students ◦ Collectibles  Some uses: ◦ Quickly checking if an item is in a collection Op Operati ations ons HashS hSet et Tr TreeSet Add/remove item O(1) O(lg n) Contains? O(1) O(lg n) Q5 Can hog space Sorts items!

  7.  Associate keys with va values es  Real- world “maps” ◦ Dictionary ◦ Phone book  Some uses: ◦ Associating student ID with transcript ◦ Associating name with high scores Op Oper erati ations ons HashMap hMap Tr Tree eeMap ap Insert key-value pair O(1) O(lg n) Look up value for key O(1) O(lg n) Q6 Can hog space Sorts items by key!

  8. The only blood these contracts are signed in is from me cutting my hand trying to open the d@^mned CD case.

  9. Demonstration

  10.  Input: a text file the skunk jumped over the stump the stump jumped over the skunk the skunk said the stump stunk and the stump said the skunk stunk  Output: a randomly generated list of words that is “like” the original input in a well-defined way

  11.  Gather statistics on word patterns by building an appropriate data structure  Use the data structure to generate random text that follows the discovered patterns

  12. Prefix Suffix ffixes  Input: a text file NONWORD the the e skunk nk jumped mped ove ver the stump the skunk (4), the e stump p jumped mped ove ver the skunk nk stump (4) the e skunk nk said the stump mp stunk k jumped, said, skunk and d the stump mp said the skunk nk stunk nk stunk, the jumped over (2) over the (2) stump jumped, said, stunk, the said the (2) and, stunk NONWORD and the

  13.  Input: a text file Prefi fix Suffixe fixes the e skunk nk jumped mped ove ver the stump NW NW the the e stump p jumped mped ove ver the skunk nk NW the skunk the e skunk nk said the stump mp stunk k jumped, the skunk and d the stump mp said the skunk nk stunk nk said, the, stunk skunk jumped over jumped over the stump, over the skunk the, jumped, the stump stunk, said …

  14.  n=2:  n=1: the skunk said the the skunk the skunk stump stunk and the jumped over the stump jumped over skunk stunk the skunk jumped over the skunk stunk  Note: it’s also the skunk stunk possible to hit the max before you hit the last nonword.

  15.  For the prefixes? Prefi fix Suffixe fixes NW NW the  For the set of suffixes? NW the skunk jumped, the skunk said, the,  To relate them? stunk skunk jumped over jumped over the stump, over the skunk the, jumped, the stump stunk, said …

  16.  The Markov assignment template is in a new repository: http://svn.cs.rose-hulman.edu/repos/csse220-200910-team2 n  where n is: n 1 Alice and Steve 2 Gardner and Cory 3 Joe and Sam  Make sure you can attach to the new repository now, get help if stuck

  17.  FixedLengthQueue: a specialized data structure, useful for Markov problem  Check out FixedLengthQueue  Work with your Markov partner to implement it in the next 25 minutes or so  Then read (twice) and begin digesting the Markov assignment  Discuss it with your partner

  18. Review HW description, Partners work on Markov for rest of class

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend