7regular - Introduction to Computer Science • Sedgewick...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Introduction to Computer Science • Sedgewick and Wayne • Copyright © 2007 • http://www.cs.Princeton.EDU/IntroCS 7. Theory of Computation 2 Introduction to Theoretical CS Two fundamental questions. ! What can a computer do? ! What can a computer do with limited resources? General approach. ! Don't talk about specific machines or problems. ! Consider minimal abstract machines. ! Consider general classes of problems. e.g., Pentium M running Linux kernel 2.6.15 3 Why Learn Theory? In theory … ! Deeper understanding of what is a computer and computing. ! Foundation of all modern computers. ! Pure science. ! Philosophical implications. In practice … ! Web search: theory of pattern matching. ! Sequential circuits: theory of finite state automata. ! Compilers: theory of context free grammars. ! Cryptography: theory of computational complexity. ! Data compression: theory of information. In theory there is no difference between theory and practice. In practice there is. - Yogi Berra Introduction to Computer Science • Sedgewick and Wayne • Copyright © 2007 • http://www.cs.Princeton.EDU/IntroCS Regular Expressions and DFAs 5 Pattern Matching Applications Test if a string matches some pattern. ! Process natural language. ! Scan for virus signatures. ! Search for information using Google. ! Access information in digital libraries. ! Retrieve information from Lexis/Nexis. ! Search-and-replace in a word processors. ! Filter text (spam, NetNanny, ads, Carnivore, malware). ! Validate data-entry fields (dates, email, URL, credit card). ! Search for markers in human genome using PROSITE patterns. Parse text files. ! Compile a Java program. ! Crawl and index the Web. ! Read in data stored in TOY input file format. ! Automatically create Java documentation from Javadoc comments. 6 Pattern Matching in Google Google. Supports * for full word wildcard and | for union. 7 Pattern Matching in TiVo TiVo. WishList has very limited pattern matching. Reference: page 76, Hughes DirectTV TiVo manual 8 Describing a Pattern PROSITE. Huge database of protein families and domains. Q. How to describe a protein motif? Ex. [signature of the C2H2-type zinc finger domain] ! C ! Between 2 and 4 amino acids. ! C ! 3 more amino acids. ! One of the following amino acids: LIVMFYWCX . ! 8 more amino acids. ! H ! Between 3 and 5 more amino acids. ! H C AAS C GGP Y ACGGWAGY H AGW H 9 Regular Expressions: Basic Operations Regular expression. Notation to specify a set of strings. every other string aabaab aabaab Concatenation every other string aaaab abaab a(a|b)aab Parentheses (ab)*a ab*a aa | baab .u.u.u. Regular Expression aa abbba a ababababa ab ababa aa abbba Closure Union Wildcard Operation every other string aa baab succubus tumultuous cumulus jugulum No Yes 10 Regular Expressions: Examples Regular expression. Notation is surprisingly expressive....
View Full Document

This note was uploaded on 12/16/2008 for the course COS 126 taught by Professor Douglasw.clark during the Fall '08 term at Princeton.

Page1 / 9

7regular - Introduction to Computer Science • Sedgewick...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online