CSCE 222 Lecture 26

From Notes
Jump to navigation Jump to search

« previous | Friday, April 8, 2011 | next »


Merge-Sort

Recurrence relation of:

By comparing to the general Master Theorem function, , so


Multiplication

(From previous lecture)

Therefore,


Chapter 12: Modeling Computation

Formal Languages

alphabet (vocabulary)
a finite non-empty set of certain symbols
If represents our alphabet, represents the set of all words over
word (sentence)
a string of finite length over an alphabet/vocabulary
empty string represented by λ (some books use ε)
grammar
a 4-tuple that consists of:
  • an alphabet
  • terminal symbols or keywords (a subset of )
  • a start symbol (a symbol in )
  • a finite set of productions
is a set of all non-terminal symbols.
Note: terminal symbols will never occur on the left hand side.
⇒ represents that a single rule is applied to the left-hand side to produce the right-hand side (1-step)
⇒* represents that multiple rules are applied to the left-hand side to produce the right-hand side (n-step)
language
a set of a grammar such that a start symbol can be converted into a terminal symbol in any number of steps

Example 1

  • is start symbol

What kind of words can we generate with this grammar?

  1. Start out with S (start symbol)
  2. Use any rules in P with S on the left-hand side
  3. Choose any production rule that matches any set of symbols that were returned by the previous step
  4. Once we are left with terminal symbols, nothing more can be produced by those letters

S1 ABa2 BBBa3 × 3 abababa


Example 2