DOC PREVIEW
DREXEL CS 265 - Lecture 5

This preview shows page 1-2-3 out of 8 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 8 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 8 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 8 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 8 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Design and Implementation*ThemesTopicsFailed AttemptsMarkov AlgorithmSample Markov AlgorithmHash Table to Find Suffix Following Two Word PrefixImplementationDesign and Implementation*• Objective: To design and implement a program for a relatively small yet reasonably complicated problem. To introduce and review a variety of implementation languages and to have students review the pros and cons of different implementation choices and languages.• “Show me your flowcharts and conceal your tables, and I shall continue to be mystified. Show me your tables, and I won’t usually need your flowcharts; they’ll be obvious”– Frederick P. Brooks, The Mythical Man Month*The examples in these slides come fromBrian W. Kernighan and Rob Pike,“The Practice of Programming”, Addison-Wesley, 1999.Themes• “Once the data structures are laid out, the algorithms tend to fall into place, and the coding is comparatively easy”• The choice of programming language is relatively unimportant to the overall design.• Comparing implementations demonstrates how languages can help or hinder, and ways in which they are unimportant.Topics• Problem: Generate random English text that reads well.• Program: some data comes in, some data goes out, and the processing depends on a little ingenuity.• Implementations: C, C++, Java, PerlFailed Attempts• Generate random letters (even with proper frequency.• Generate random words chosen from a dictionary• Need a statistical model with more structure (frequency of whole phrases)Markov Algorithm•set w1and w2to the first two words in the text•print w1and w2• loop:– randomly choose w3, one of the successors of w1and w2(in sample text)–print w3– replace w1and w2by w2and w3Sample Markov Algorithm• Input Prefix:– show your– your flowcharts– flowcharts and– flowcharts will– your tables– will be– be mystified– be obvious• Suffix words that follow– flowcharts tables– and will– conceal–be– and and– mystified. obvious.–Show – (end)Hash Table to Find Suffix Following Two Word Prefixa state:pref[0]sufnextpref[1]pref[0]sufpref[1]another state:“show”“your”“flowcharts”a suffix:wordnextanother suffix:“tables”wordnextnextImplementation• See lecture outline for links to 4 different implementations– C (see Makefile)–C++–Java–Perl• What are the pros and cons of the different


View Full Document

DREXEL CS 265 - Lecture 5

Download Lecture 5
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lecture 5 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture 5 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?