# Register now to access 7 million high quality study materials (What's Course Hero?) Course Hero is the premier provider of high quality online educational resources. With millions of study documents, online tutors, digital flashcards and free courseware, Course Hero is helping students learn more efficiently and effectively. Whether you're interested in exploring new subjects or mastering key topics for your next exam, Course Hero has the tools you need to achieve your goals.

2 Pages

### c318f00t2

Course: CSE 318, Spring 2008
School: Lehigh
Rating:

Word Count: 305

#### Document Preview

318 CSc Test 2 Wednesday 25 October 2000 &gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;SUGGESTED ANSWERS&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt; 1. (15 pts) Prove the following theorem. Theorem. Given DFA's M=(Q, , s, F, ) and N=(Q, , s, F', ). If F F' then L(M) L(N). x L(M) (s,x) F (s,x) F' x L(N) 2. (20 pts)...

Register Now

#### Unformatted Document Excerpt

Coursehero >> Pennsylvania >> Lehigh >> CSE 318

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
318 CSc Test 2 Wednesday 25 October 2000 >>>>>>>>>>SUGGESTED ANSWERS<<<<<<<<<<<<<< 1. (15 pts) Prove the following theorem. Theorem. Given DFA's M=(Q, , s, F, ) and N=(Q, , s, F', ). If F F' then L(M) L(N). x L(M) (s,x) F (s,x) F' x L(N) 2. (20 pts) Let A be the regular expression given by A=(a a*)(ab) and let M be the NFA ({s,1,2}, {a,b}, s, {2}, {(s,a,1), (1,a,1), (1,b,2), (2,b,2)}). a. Give the language expression for L(A). >>> ({a} {a}*){a}{b} b. Prove that L(A) L(M) >>>First I note that (clearly) L(A)={a k b: k>0}. For ak b, ({s}, ak b) = ({1}, ak-1 b) =... ({1}, b) = {2} ak b L(M). c. Find some x L(M) - L(A), that is an x in the language of the NFA but not in L(A). >>>> abb L(M) - L(A), 3. (25 pts) Prove that {a, b, c}* is countable. Define the 1-1 (no onto, which is unnecessary) f:{a,b,c}* {0, 1, 2, ...} by f( )=0, f(a)=1, f(b)=2, f(c)=3. In general, f( 1 2.... n)= 1 + 4 2 + 42 3 + ... +4n-1 n Now, to show f that is 1-1, suppose that f( 1 2.... n)= f( 1 2.... m), then 2 n-1 2 n-1 1+ 4 2 + 4 3 + ... +4 n= 1+ 4 2 + 4 3 + ... +4 m . Taking the remainder of both sides after division by 4 gives 1 = 1. Then dividing both sides gives 2+ 4 3 + 42 4 + ... +4n-2 n = 2 + 4 3 + 42 4 + ... +4n-2 m . Repeat the process to get 2= 2 , 3= 3 , 4= 4 , .... and conclude 1 2.... n= 1 2.... m 4. (10 pts) Find a regular expression for {ax: |ax|=3, x {a, b}*}. >>>>>>>>> aaa aab aba abb 5. (15 pts) Find an NFA equivalent to the -NFA ({s,1,2}, {a,b,c}, s, {1}, {(s,a,1), (s, ,1), (1,b,1), (1,b,2), (1, ,2), (2,c,2)}). a b c -------------------------s 1 1 1 1,2 2 2 2 ---------------------------s 2 s 1,2 2 1 2 Now, throw away the -transitions to get: a b c -----------------s 1 1,2 2 1 1,2 2 2 2 (15 pts) Find a DFA equivalent to the NFA ({s,1,2}, {a,b,c}, s, {1}, {(s,a,1), (s,a,2), (s,b,1), (1,b,2), (2,b,s), (2,c,s)}). a b c {s} {1,2} {1} {1} {2} {1,2} {s,2} {s} {2} {s} {s} {s,2} {1,2} {s,1} {s} {s,1} {1,2} {1,2} 6.
Find millions of documents on Course Hero - Study Guides, Lecture Notes, Reference Materials, Practice Exams and more. Course Hero has millions of course specific materials providing students with the best way to expand their education.

Below is a small sample set of documents:

Lehigh - CSE - 318
CSc 318 Test 3 Wednesday 29 November 2000 &gt;SUGGESTED ANSWERS&lt; 1. (15 pts) Let L be the language of the DFA M=(Q, , s, F, ). Find an -NFA for the language LL. Assume Q={q1, q2 , ., qn }, s= q1. Let Q'={q'1, q'2 , ., q'n }, s'=q'1, such that Q Q'= . M'
Lehigh - CSE - 17
CSc 17 Test 2 Thursday 8 April 1999 .&gt;ANSWERS&lt; 1. (10 pts) Assume the following data structure is used to create a linked list: class Link{public: int key,next; }; class LinkedList{ private: int head,count; Link data[10]; public: /other stufff } Furt
Lehigh - CSE - 17
CSc 17 Test 2 Friday 13 November 1998 &gt; Answers &lt; 1.Page 1(15 pts) In writing the function below, I forgot to provide the documention. Provide it by stating the pre- and post-conditions. The function assumes the class Node, which is defined as fo
Lehigh - CSE - 318
CSc 318 Final Examination Saturday 16 December 2000 8 AM &gt;SUGGESTED ANSWERS&lt; 1. Consider the set of DFA's which can be constructed over some alphabet . Prove that equivalence of DFA's is an equivalence relation on this set. I show that the relation i
Lehigh - CSE - 17
CSc 17 Final Examination Wednesday 12 May 1999 4 PM Page 1 !SUGGESTED ANSWERS! 1. (10 pts) Assume class Staque implements an ADT which has the properties of both a stack and a queue. Further assume that Staque has the member functions push(int), enqu
Lehigh - CSE - 17
CSc 17 Test 1 1.Wednesday 8 October 1997ANSWERS(15 pts) This is a true-false question. After each expression state whether the expression evaluates to true or to false. ( 3/2 = (2/3+1) TRUE ('a'&gt;'b') | ( ('b'-'a')&gt;0 ) ) TRUE ('a'+int(true)&gt;'a')
Lehigh - CSE - 318
CSc 318 Test 3 Wednesday 1 December 1999.TEST 3 SUGGESTED ANSWERS1. (10 pts) Prove that the grammar below is ambiguous. S A B AA | BAB aa | Sa a | abSThe trees for the following two derivations of aaaa differ. S S SS /\/|\ AABAB /\|\|/\| aaaaaaa
Lehigh - CSE - 17
CSc 17 Test 1 1.Thursday 10 June 1999#ANSWERS# (10 pts)Given the function definitions below, state what output is generated by the code below the dashed line. void b(int &amp; x, int &amp;y) {y+; x+=y; cout &lt;x&lt;&quot; &quot;&lt;y&lt;&quot; &quot;; } void a(int &amp; x, int&amp; y,int z) {
Lehigh - CSE - 318
CSc 318 Test #1 Wednesday, 27 September 2000 &gt;SUGGESTED ANSWERS&lt; 1. Prove A B A A B B. A B 1-1, onto f:A B. Define 1-1, onto g: A A B B by g(x,y) = (f(x), f(y). g is 1-1, because g(x,y)=g(u,v) (f(x),f(y)=(f(u),f(v) f(x)=f(u) and f(y)=f(v) x=u and y=v
Lehigh - CSE - 17
CSc 17Test 2Friday27 March 1998Page 1&gt;ANSWERS&lt; 1. (10 pts) In writing the function below, I forgot to provide the documention. Provide it by stating the pre- and post-conditions. void x (int y[], int m, int n) /Pre-Condition: 0&lt;=m&lt;=n /Post-
Lehigh - CSE - 17
CSc 17 Test 2 24 June 1999 Page 1 &gt;ANSWERS&lt; 1. (15 pts) (a) Using the standard algorithm for building a binary tree for storing numbers in order: (1) show the state of the tree after the numbers 15, 12, 14, 6, and 9 have been added to an empty tree i
Lehigh - CSE - 17
CSc 17 Test 1 Friday 2 October 1998 Page 1 &gt;ANSWERS&lt; 1. Assume that we have #include&lt;math.h&gt;. Explain why the segment of code in (a) causes a run-time error (i.e., crashes) and why the segment of code in (b) executes without a run-time error (i.e., d
Lehigh - CSE - 17
CSc 17 Final ExaminationMonday 15 December 1997 4 PM&gt;ANSWERS&lt; CLOSED BOOK, CLOSED NOTES. ANSWERS AVAILABLE AFTER THE TEST ON MY WEB PAGE AND ON THE BULLETIN BOARD CSCKAY 1. (20 pts) Suppose we have a class called Stack whose instances implement a
Lehigh - CSE - 17
CSc 17 Test 1 Monday 18 October 1999 Page 1 &gt;SUGGEST ANSWERS&lt; 1. (15 pts) Given that the function 'truth' is defined as char truth(bool t){ if(t) return 'T'; return 'F';} what is the output of the following lines of code? cout&lt;(2+3%4*5/6%7)&lt;endl; cou
Lehigh - CSE - 17
CSc 17 Page 1Final ExaminationMonday14 December 19981. ( pts) Assume the declarations of class biNode and of rt below. Write a function &quot;zero&quot; such that the call &quot;zero(rt)&quot; stores a 0 in each leaf of the tree whose root is rt. The function as
Lehigh - CSE - 17
CSc 17 Final ExaminationFriday 2 July 1999Page 1&gt;ANSWERS&gt;. 1. (25 pts) Call an array of ints with one entry &quot;balanced&quot; if the entry is 9. Call an array of ints with two entries &quot;balanced&quot; if the sum of the two entries is 9. Call an array of int
Lehigh - CSE - 17
CSc 17 Final Saturday 18 December 1999 &gt;SUGGESTED ANSWERS&lt;, 1. (25 pts) a. Provide the missing documentation for the function below. b. Determine the complexity of the algorithm used in the function and state the complexity in terms of the O() notati
Lehigh - CSE - 17
CSc 17 Test 1 Monday 22 November 1999 &gt;SUGGESTED ANSWERS&lt; 1. (25 pts) Write a private recursive member function for the class Tree which visits every node in a binary tree and increments the number in each node by 1. Assume the function is named INC
Lehigh - CSE - 17
CSc 17 Test 1 Wednesday 17 October 2001 =SUGGESTED ANSWERS MARKED WITH &quot;&lt;&quot; = 1. (16 pts) Assume you have the function v() below (which I forgot to format): char v(int x, int y) {char ch; ch='C'; if(x&lt;y) if(x&gt;0) if(x&lt;5) ch='D'; else {if(x&gt;77) ch='A';}
Lehigh - CSC - 262
CSc 262 Final Examination Saturday, 12 December 1998 4-7 PM Suggested answers will be posted on CSCKAY shortly after 7.Page 1Name_ 1. (25 pts) In this question I ask you to provide the details of the activation records for the Pascal program belo
Lehigh - CSE - 17
CSE 17 Test 1 Tuesday 18 October 2005 &lt;SUGGESTED ANSWERS&gt; 1. Write a program that prompts the user to enter four strings from the console and then displays the lexicographically (as they would appear in a case-sensitive dictionary) smallest and large
Lehigh - CSE - 17
CSc 17 Test 1 6 June 2002 &gt;SUGGESTED ANSWERS&lt; 1. (20 pts) Given some function &quot;statement()&quot; and the code for(int j=0;j&lt;n;j+=3) statement(j); a) Write a while loop which has the same effect as the above for loop b) Write a do-while loop which has the
Lehigh - CSE - 17
CSc 17 Final Examination Tuesday 18 December 2001 &gt;SUGGESTED ANSWERS&lt; 1. (25 pts) The code below will compile but not link, because the function f() is not defined. Add code for a single function f() to the code below so that the code compiles and ru
Lehigh - CSE - 17
CSc 17 Test 2 20 July 2002 *SUGGESTED ANSWERS* 1. (10 pts) What is the output of the following program? void a(int *p,int *&amp;q) {p[1]=5; q=p; p=new int(14); } int main() { int *x,*y,v[]={1,2,3,4},z[]={6,7,8,9}; x=v; x[1]=0; for(int j=0;j&lt;2;j+) cout&lt;v[
Lehigh - CSE - 17
CSE 17 FINAL TUESDAY 20 DECEMBER 2005 &lt;SUGGESTED ANSWERS&gt; 1. For the following scenarios, what would be the best data structure to use as the primary data structure in a Java implementation? Justify your choice. Choose from the following data structu
Lehigh - CSE - 17
CSE 17 Test 2 Tuesday 15 November 2005 &gt;SUGGESTED ANSWERS&lt; 1. Design a class called Dictionary that is a subclass of the Book class. Create the methods in Dictionary so that word.main() produces the following output. Number of pages: 1500 Number of d
Lehigh - CSE - 17
CSE 17 Final Examination Wednesday 20 December 2006 &lt;SUGGESTED ANSWERS&gt; 1. For each of the questions below, assume the following data are processed in the given order: 11, 26, 64, 63, 76, 50. (a) Assume the data are entered into a binary tree, where
Lehigh - CSC - 262
CSc 262 1.Test 2Suggested Answers(20 pts) Suppose that Algol allowed parameters to be passed in three ways, by value, by reference, and by name. What would be the output of the following program if, in procedure M, x is passed by value, y by re
Lehigh - CSE - 17
CSc 17 Final Examination Tuesday 19 December 2000 &gt;SUGGESTED ANSWERS&lt; 1. Write the declaration for a class FlipFlop and then write the definition of its member functions and operators. Instances of class FlipFlop store either the value of 0 or 1. If
Lehigh - CSC - 262
CSc 262 Final Examination Thursday 11 December 1997 8 AM &gt;SUGGESTED ANSWERS&lt;, 1. (20 pts) Write a recursive LISP function entryn such that evaluating the expression (entryn n alist) returns the nth entry in the list alist, if it has at least n entrie
Lehigh - CSC - 262
CSc 262Test 3Wednesday12 November 1997 Suggested answers available after test.Closed book, closed notes.1. (40 pts) Below is a Pascal program to list the moves in solving the Towers of Hanoi problem. Certain statements in the program have c
Lehigh - CSE - 17
CSE 17 Test 1 Friday 6 October 2006 &gt;SUGGESTED ANSWERS&lt; 1. Write a class P, whose main program forces the user to enter three integers and then tells the user whether the sum of the squares of the first two is equal to the square of the third (Pythag
Lehigh - CSE - 17
CSE 17 Test 1 Friday 17 November 2006 &lt;SUGGESTED ANSWERS&gt; 1. Assume the following class: public class Node{ public int j; public Node next; } Write a method list() for listing the contents of a linked list of Nodes in the file &quot;test2.out&quot;. Given Node
Lehigh - CSE - 17
CSc 17 Test 2 Wednesday 28 November 2001 &gt;SUGGESTED ANSWERS&lt; 1. (10 pts) Using the algorithms discussed in class for building a balanced binary tree for sorting integers, draw a picture of the tree after each of the numbers listed in (a) are added to
Lehigh - CSE - 17
CSc 17 Test 2 20 November 2000 &gt;SUGGESTED ANSWERS&lt;, 1. (20 pts) Assume the class LinkList below. Write a member function of LinkList called same() which returns true if and only if two linked lists have the same data in the same order. Given the decl
Lehigh - CSE - 17
CSc 17 Final Examination28 July 20021. (25 pts) Write a function numberLines() which reads text from a file and faithfully echoes it to the screen, except that it appends the line number at the end of each line in the form [xx]. For example, if t
Lehigh - CSC - 262
Possible answers to the test are below the test. CSc 262 Test 1 Friday, 19 September 1997Each question worth 20 points. 1. You are designing a pseudo-code for a machine with 512 words of data memory, 512 words of a separate program memory, where ea
Lehigh - CSC - 262
CSc Test 1 Friday 25 September 1988 ANSWERS 1. (15 pts) Given the assignment x=2-3*4-5, for each of a), b), and c) below, find a set of precedence and hierarchy rules for the operatores &quot;-&quot; and &quot;*&quot; such that a) x=-15 b) x=-9 c) x=5 a) Higher preceden
Lehigh - CSC - 262
CSc 262Test 1Friday23 October 1998&gt;ANSWERS&lt; 1. (15 pts) Suppose we have the program ONE below, which is written in some programming language, say ELBONIAN. PROGRAM ONE; INTEGER GLOBAL; INTEGER ARRAY LIST[1.3]; PROCEDURE SUB(PARAM1:INTEGER; PA
Lehigh - CSC - 262
CSc 262 Test 3 20 November 1998 &gt;SUGGESTED ANSWERS&lt; 1. (40 pts) In this question I ask you to provide the details of the activation records for the Pascal program below. Beside each statement in the program is the (hypothetical) decimal address for t
Lehigh - CSE - 17
CSc 17 Test 1 Wednesday 18 October 2000 &gt;SUGGESTED ANSWERS&lt; 1. (12 pts) Assume the statement if(x&lt;y) if(x&lt;5) cout&lt;'D'; else if(x&gt;77) cout&lt;'A'; else cout&lt;'B'; is preceded by one of the four pairs of statements below. State the output that occurs for e
Tulane - FINC - 725
I. Debt and val ueWe examine two important stories for the benefit and cost tradeoffs from using debt. Later we will examine more stories A. Tax shields and bankruptcy cost B. Agency costs of debt and equity C. Sum up1Income StatementSales t CO
Lehigh - BIOS - 95
Cardiovascular disease, studies at the cellular and molecular levelLinda LoweKrentz Bioscience in the 21st Century November 14Risk Factors High blood pressure (above 120/80 mm Hg) Serum cholesterol [aim for below 100 mg/dL LDL cholesterol and
Lehigh - CALC - 1,2,3
6.5 Average Value of a FunctionIf f is continuous on [a, b], then the average value of f on this interval is given by1 b ab af ( x)dxMean Value Theorem for IntegralsIf f is continuous on [a, b], then there exists a number c in [a, b] such t
Lehigh - BIOS - 95
Professor Robin S. Dillon Department of Philosophy Lehigh UniversityA Framework for Moral Reasoning and Decision-Making in Bioethics 1I. Morality Morality is a universally valid and applicable, impartial, rationally justified system for making dec
Lehigh - BIOS - 95
Genomes: What we know . and what we don't knowComplete draft sequence 2001October 15, 2007Dr. Stefan Maas, BioS Lehigh U. SMaas 2007What we knowRaw genome data SMaas 2007The range of genome sizes in the animal &amp; plant kingdoms! No cor
Lehigh - BIOS - 95
Principles and Ethics of Clinical ResearchJohn Glod, M.D., Ph.D. Departments of Pediatrics and Pharmacology Robert Wood Johnson Medical School The Cancer Institute of New JerseyGoals of clinical research New therapies Improving outcomes Reducin
Lehigh - BIOS - 95
Fluorescence Bioimaging in Translational ResearchKim Wicklund, PhDResearch Imaging Product Manager Scientific Equipment GroupOutline What is fluorescence? How can we put it in a biological system? How can we see it?LightElectromagnetic ener
Lehigh - CALC - 1,2,3
11.10 Taylor and Maclaurin Series Find the Taylor series (or Maclaurin Series) of a function Calculate the coefficients directly by using Theorem 5. Theorem 5 If f has a power series representation (expansion) at a, that is, iff (x) =n=0cn (x
Tulane - FINC - 725
Optimal Risky PortfoliosBKM Chapter 7Mean standard deviation diagrams Mean variance analysis: 2 risky assets Mean variance analysis: 3 or more risky assets Many risky assets and the risk-free asset Two Risky Assets; No risk-free asset (This mate
Tulane - FINC - 725
IV. DDM and FCFF Growth ModelWe examine some growth valuation models; A. B. C. D. E. F. The DDM- dividend discount model FCFF growth model Super-to-normal FCFF growth model Finding DDM from FCFF model Spreadsheet versus model approach Application to
Tulane - FINC - 725
FINC 727: Valuation and financing enterprises, GW II 3111Professor Robert S. HansenOVERVIEW Professor 865-5624 rob.hansen@tulane.edu Hours: M-144 GW II, Wed. 4-6 pm, and by appointment Faculty Assistant Ethel Matshiya 865-5666 Ethel is at the Mez
Lehigh - BIOS - 95
Contagious Others: The Egyptian Ophthalmia in Mary Shelley's FrankensteinElizabeth A. Dolanbdolan@lehigh.eduFrom Seeing Suffering in Women's Literature of the Romantic Period, Ashgate Press (2008)Plot summaryEmbedded narration Robert Walton (se
Lehigh - CALC - 1,2,3
7.4 Integration of Rational Functions by Partial FractionsThis section examines a procedure for decomposing a rational function into simpler rational functions to which we can apply the basic integration formulas.A. Partial Fraction Decomposition
Lehigh - CALC - 1,2,3
Lehigh - CALC - 1,2,3
Tulane - FINC - 725
Political Capital Politics &amp; Policy Let Capital Markets, Not Financial Firms, Govern Fate of IPOs By Alan Murray 897 words 10 September 2002 The Wall Street Journal A4 English (Copyright (c) 2002, Dow Jones &amp; Company, Inc.) IT HAS BEEN 13 YEARS since
Lehigh - CALC - 1,2,3
A Quick Introduction to Factor Analysis From Data Analysis: A Statistical Primer for Psychology Students by Edward L. Wike: . . . [T]here are elaborate extensions of r to multivariate data . . . another case is k variables (factor analysis). Fortunat
Lehigh - CALC - 1,2,3
February 11, 2005Announcements Review L'Hospital Rule Today 7.7 Approximate Integration What can you do when you are asked to estimate1 1e dx0x2or0cos(x3 ) dx?1Let f be a continuous function on [a, b]. Divide [a, b] into n subinterv
Lehigh - CALC - 1,2,3
February 14, 2005Announcements Reading for this Week: 7.8, 8.1 and 8.3. Midterm # 2 is next week! Thursday, February 24th (Covers 7.1 - 8.1) Start doing practice Midterms. Modification to Week 8 homework: Problems 1, 5, 7, 11, 12 and 15 in 8.3 a
Tulane - FINC - 725
FINC 727: Corporate transactions and business valuationProfessor Robert HansenAssignment 1. CAPM and WACC in valuationBLAZER TELECOM s has perpetual earnings before interest and taxes of \$400, the corporate tax rate is 40%. BLAZER uses a debt-t