Notes/UNB/Year 4/Semester 2/CS2333/2024-01-24.md
2024-01-24 13:48:22 -04:00

1.5 KiB

Lecture Topic:

Equivalence Classes

You can represent equivalence classes by writing each one as a set:

C_0 = \{..., -10, -5, 0, 5, 10, 15, ...\} \text{ or } \{5p | p \in \mathbb{Z}\}
C_0 = \{..., -9, -4, 1, 6, 11, 16, ...\} \text{ or } \{5p + 1| p \in \mathbb{Z}\}
\text{and so on...}

Graphs

Definitions:

  • For each vertex v, the degree of v is the number of edges incident on v
  • A path is a sequence of vertices connected by edges
  • A cycle is a path that starts and ends at the same vertex
  • A simple path is a path that has no repeated vertices
  • A connected graph contains a path between every pair of vertices
  • A disconnected graph is the opposite (look at slides for real def)

Regular Languages

A class of languages that can be processed by simple computers called finite automata

Simple Example of a finite automaton

Vending machine/toll booth gate Requires 25 cents or more to be deposited (gives no change)

Takes as input, 5 cent, 10 cent, 25 cent coins Uses states to remember how much has been deposited so far

States:

  • q_0 : 0 cents deposited (START STATE)
  • q_5 : 5 cents
  • q_10 : 10 cents
  • q_15 : 15 cents
  • q_20 : 20 cents
  • q_25 : 25 cents (ACCEPT STATE)

We represent the input as a string of symbols.

  • n = nickel
  • d = dime
  • q = quarter Examples:
  • ddn
  • ndd
  • dnd
  • q Not accepted examples:
  • nd
  • d
  • \epsilon

State Diagram

(not really possible without an image in obsidian)

Finite Automata

(look at slides, didn't catch it)