Download presentation
Presentation is loading. Please wait.
1
CSSE221: Software Dev. Honors Day 15 Announcements Announcements Pass in UML for Cars, Trucks, Trains Pass in UML for Cars, Trucks, Trains Homework 5 late day? Pass in now Homework 5 late day? Pass in now Better to defer CSSE230 until Spring Better to defer CSSE230 until Spring Exam 1 next class: if you qualify for extra time, talk to me later this class. Exam 1 next class: if you qualify for extra time, talk to me later this class. How are the capsule demos and prep going? How are the capsule demos and prep going? What’s working? What’s working? What do you plan to do differently next time? What do you plan to do differently next time? Yesterday’s groups will get grade later this week. Yesterday’s groups will get grade later this week.
2
This week: Markov Monday: Monday: Stacks and Queues Stacks and Queues Sets, Maps, and PriorityQueues Sets, Maps, and PriorityQueues Tuesday: Tuesday: Some pros and cons of various data structures Some pros and cons of various data structures Brief example of file I/O Brief example of file I/O Introduction to Markov, a cool statistical text program with lots of data structures Introduction to Markov, a cool statistical text program with lots of data structures Thursday: Thursday: Exam 1 Exam 1
3
Questions on Exam 1?
4
Demo Wrap up of Sets, Maps, and PriQueues Wrap up of Sets, Maps, and PriQueues By the way, which of the data structures that we discussed yesterday could be called an associative array? By the way, which of the data structures that we discussed yesterday could be called an associative array?
5
Markov Teams bennetrn-beltonj1 fishmad-sullivja skilessa-speyerea crockeea-morrisps johnsoad-priestjs lundgrpb-smithny leveyjr-wentztj bennindp-mcginnda clutecc-dovalojd gatesds-millerbe heinma1-hulettbh johnsoac-rubinza kruthar-richarme behlinmc-eckertwm mosttw-reillytm nibertjw-stokesej bennetdj Repos is csse221-200810- -. If solo, use your personal repos. Find your partner
6
Simple File I/O Key concepts: Key concepts: File objects and exceptions: File objects and exceptions: new File(“fileName”) new File(“fileName”) Output: construct a PrintWriter from that file, and use it in place of System.out) Output: construct a PrintWriter from that file, and use it in place of System.out) Input: construct a Scanner from that file and use it like you would getting keyboard input Input: construct a Scanner from that file and use it like you would getting keyboard input Demo: SimpleFileIODemo Demo: SimpleFileIODemo
7
Use other techniques for reading binary files Data is more compact than text Data is more compact than text.read(),.write() methods.read(),.write() methods Maybe we’ll study later? Maybe we’ll study later?
8
Markov Input: a text file 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 Processing: Gather word pattern statistics Store them in an appropriate data structure Output: a text file with many of the same properties as the original file Output: a text file with many of the same properties as the original file Full-justified, of course Full-justified, of course
9
Markov Input: a text file 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 Statistics: NONWORDthe the skunk (4), stump (4) skunk jumped, said, stunk, the jumped over (2) over the (2) stump jumped, said, stunk, the said the (2) stunk and, NONWORD andthe
10
Markov Input: a text file 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 Statistics: NONWORD the skunk jumped over stump said stunk and
11
Markov Input: a text file 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 Statistics: NONWORDthe the skunk (4), stump (4) skunk jumped, said, stunk, the jumped over (2) over the (2) stump jumped, said, stunk, the said the (2) stunk and, NONWORD andthe
12
Markov Input: a text file 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 Statistics (n=2): NW NW NW the the skunk skunk jumped jumped over over the the stump …
13
Markov Input: a text file 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 Statistics (n=2): NW NW NW the the skunk skunk jumped jumped over over the the stump …
14
Markov Input: a text file 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 Statistics (n=2): NW NW the NW the skunk the skunk jumped, said, stunk, the skunk jumped … jumped over over the the stump …
15
Output n=1: n=1: the skunk the skunk jumped over the skunk stunk the skunk stunk n=2: the skunk said the stump stunk and the stump jumped over the skunk jumped over the skunk stunk Note: it’s also possible to hit the max before you hit the last nonword.
16
Data structures For the prefixes? For the set of suffices? To relate them? Statistics (n=2): NW NW NW the the skunk skunk jumped jumped over over the the stump …
17
Full Justification Do this step LAST Do this step LAST Output needs to be full-justified. Output needs to be full-justified. Required to use lists (array and linked) to hold the output line and modify it before you print it Required to use lists (array and linked) to hold the output line and modify it before you print it
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.