Presentation is loading. Please wait.

Presentation is loading. Please wait.

Problem Session 1 CS 302. Topics LaTeX Questions from Class Extra problems.

Similar presentations


Presentation on theme: "Problem Session 1 CS 302. Topics LaTeX Questions from Class Extra problems."— Presentation transcript:

1 Problem Session 1 CS 302

2 Topics LaTeX Questions from Class Extra problems

3 LaTeX Typesetting software for math Used by scientific community Why should you learn it?

4 How to get LaTeX (windows) Download MikTeX (www.miktex.org)www.miktex.org Download TeXnicCenter (or other IDE) (www.toolscenter.org)www.toolscenter.org

5 Starting a document \documentclass[12pt]{article} \pagestyle{plain} \usepackage{anysize} \marginsize{2.5cm}{2.5cm}{1.5cm}{1.5cm} \begin{document} … \end{document}

6 Math Mode $ - begins math mode ^ - superscript _ - subscript \mbox – enter text in math mode \ - begins a command or escapes a character

7 Using the Preamble LaTeX allows you to create your own environments \begin{proof} Blah blah blah \end{proof} There are lots provided in the preamble

8 Lists \begin{enumerate}, \begin{itemize} \item creates a new item \begin{enumerate*} omits numbering

9 Formatting \newpage \vspace{10mm}, \hspace{10mm} newlines

10 Including Images \usepackage{graphicx} \begin{figure}[!htbp] \includegraphics[scale=.75]{hw1-9a.jpg} \end{figure} It probably won’t put things where you want. Supports jpg, ps, but not gif

11 Tutorials Links on course webpage Lots of links on wikipedia Search for what you want!

12 Questions From Class?

13 Example of Conceptual Power of Non-determinism Let L be regular Let ½(L)={x :  y |x|=|y| and xy  L}  i.e., ½(L) = first halves of strings in L Is ½(L) regular?

14 ½(L) is regular Let M be a DFA for L Construct M’ for ½(L) M’ uses the “finger method”  Place left finger on q 0 in M  Middle finger on q j, nondeterministic guess as to where x will lead  Right finger on q j

15 Transition Function As characters of x are read  M’ moves left finger along transitions dictated by characters read  And simultaneously moves right finger along a non-deterministically chosen edge which may be labeled with any character, not necessarily the one of x being read

16 Acceptance M’ accepts x iff at the end  Left finger is on q j  Right finger is on accept state Thus, M’ accepts x iff q0q0 qjqj |x||y|

17 Formal Implementation Given M=(Q, , ,q 0,F) Construct M’=(Q’, ,  ’,q 0 ’,F) Q’ = Q x Q x Q  {s}  Q x Q x Q = (left,middle,right)  s = new start state

18 Formal Implementation Guess the state q j that input x will lead to   ’(s,  ) = { : q j in Q}   ’(, a) = { :  ’(q i,a)=q l and there is b in  such that  (q k,b)=q m }  Note that the middle finger does not change after initial guess. F’={ : q j in Q, q k in F}.

19 Extra Problems True or false: if T is countable, then the set {S|S a subset of T, S is finite} is also countable.

20 True Use the Subset Sum technique T = { a 1, a 2, a 3,…} Add up the subscripts of each set of S Order by sum of subscripts, then lexicographically (i.e. a set with a 1 comes before a set with a 2 )

21 Extra Problems Is there a bijection between the interval (0,1) on the real line and all the real numbers?

22 Yes Tan(x-½ π)/π/2 Project (0,1) to semi circle centered at (½, ½). Draw the ray passing through (½, ½) and intersecting the x-axis.

23 Extra Problems Show that if we add a single 32-bit register to a DFA and that each state can store some value in it then every language this machine accepts can be accepted by a regular DFA.

24 The register adds a finite number of states to each state Add states to the machine representing all the possible values the register could have at that state

25 Extra Problems Create a DFA the recognizes the set of strings in which the number of 0s is divisible by 2 and the number of 1s is divisible by 3.

26


Download ppt "Problem Session 1 CS 302. Topics LaTeX Questions from Class Extra problems."

Similar presentations


Ads by Google