The Knapsack Problem. COSC 3101A - Design and Analysis of Algorithms 9. Fractional Knapsack Problem. Fractional Knapsack Problem

Size: px
Start display at page:

Download "The Knapsack Problem. COSC 3101A - Design and Analysis of Algorithms 9. Fractional Knapsack Problem. Fractional Knapsack Problem"

Transcription

1 The Knpsck Prolem COSC A - Design nd Anlsis of Algorithms Knpsck Prolem Huffmn Codes Introduction to Grphs Mn of these slides re tken from Monic Nicolescu, Univ. of Nevd, Reno, monic@cs.unr.edu The - knpsck prolem A thief ruing store finds n items: the i-th item is worth v i dollrs nd weights w i pounds (v i, w i integers) The thief cn onl crr W pounds in his knpsck Items must e tken entirel or left ehind Which items should the thief tke to mximize the vlue of his lod? The frctionl knpsck prolem Similr to ove The thief cn tke frctions of items 6/2/24 Lecture COSCA 2 Frctionl Knpsck Prolem Knpsck cpcit: W There re n items: the i- th item hs vlue v i nd weight w i Gol: find x i such tht for ll x i, i =, 2,.., n w i x i W nd x i v i is mximum Frctionl Knpsck Prolem Greed strteg : Pick the item with the mximum vlue E.g.: W = w =, v = 2 w 2 =, v 2 = Tking from the item with the mximum vlue: Totl vlue tken = v /w = 2/ Smller thn wht the thief cn tke if choosing the other item Totl vlue (choose item 2) = v 2 /w 2 = 6/2/24 Lecture COSCA 6/2/24 Lecture COSCA 4 Frctionl Knpsck Prolem Greed strteg 2: Pick the item with the mximum vlue per pound v i /w i If the suppl of tht element is exhusted nd the thief cn crr more: tke s much s possile from the item with the next gretest vlue per pound It is good to order items sed on their vlue per pound v v2 vn... w w w 2 6/2/24 Lecture COSCA 5 n Frctionl Knpsck Prolem Alg.: Frctionl-Knpsck (W, v[n], w[n]). While w > nd s long s there re items remining 2. pick item with mximum v i /w i. x i min (, w/w i ) 4. remove item i from list 5. w w x i w i w the mount of spce remining in the knpsck (w = W) Running time: Θ(n) if items lred ordered; else Θ(nlgn) 6/2/24 Lecture COSCA 6

2 E.g.: Frctionl Knpsck - Exmple Item Item 2 2 Item $6 $ $2 $6/pound $5/pound $4/pound 5 2 $ + 6/2/24 Lecture COSCA $8 + $6 $24 Greed Choice Items: j n Optiml solution: x x 2 x x j x n Greed solution: x x 2 x x j x n We know tht: x x greed choice tkes s much s possile from item Modif the optiml solution to tke x of item We hve to decrese the quntit tken from some item j: the new x j is decresed : (x - x ) w /w j Increse in profit: (x - x) v Decrese in profit: (x - x)w v j/w j (x - x ) v (x - x )w v /w j j v j v v v w j True, since x hd the w j w w est vlue/pound rtio j 6/2/24 Lecture COSCA 8 Optiml Sustructure The - Knpsck Prolem Consider the most vlule lod tht weights t most W pounds If we remove weight w of item j from the optiml lod The remining lod must e the most vlule lod weighing t most W w tht cn e tken from the remining n items plus w j w pounds of item j 6/2/24 Lecture COSCA Thief hs knpsck of cpcit W There re n items: for i- th item vlue v i nd weight w i Gol: find x i such tht for ll x i = {, }, i =, 2,.., n w i x i W nd x i v i is mximum 6/2/24 Lecture COSCA The - Knpsck Prolem Thief hs knpsck of cpcit W There re n items: for i- th item vlue v i nd weight w i Gol: find x i such tht for ll x i = {, }, i =, 2,.., n w i x i W nd x i v i is mximum - Knpsck - Greed Strteg E.g.: Item Item 2 2 Item $6 $ $ $ + $6 $6 $6/pound $5/pound $4/pound None of the solutions involving the greed choice (item ) leds to n optiml solution The greed choice propert does not hold $ $ $22 6/2/24 Lecture COSCA 6/2/24 Lecture COSCA 2

3 - Knpsck - Dnmic Progrmming P(i, w) the mximum profit tht cn e otined from items to i, if the knpsck hs size w Cse : thief tkes item i P(i, w) = v i + P(i-, w- w i ) Cse 2: thief does not tke item i P(i, w) = P(i-, w) 6/2/24 Lecture COSCA - Knpsck - Dnmic Progrmming i- i n P(i, w) = mx {v i + P(i-, w- w i ), P(i-, w) } : w - w i w W Item i ws tken Item i ws not tken 6/2/24 Lecture COSCA 4 first second W = 5 Exmple: P(i, w) = mx {v i + P(i -, w-w i ), P(i -, w) } P(, ) = P(, ) = P(, 2) = mx{2+, } = 2 P(, ) = mx{2+, } = 2 P(, 4) = mx{2+, } = 2 P(, 5) = mx{2+, } = 2 Item Weight Vlue P(2, )= mx{+, } = P(, )= P(2,) = P(4, )= P(,) = P(2, 2)= mx{+, 2} = 2 P(, 2)= P(2,2) = 2 P(4, 2)= mx{5+, 2} = 5 P(2, )= mx{+2, 2} = 22 P(, )= mx{2+, 22}=22 P(4, )= mx{5+, 22}=25 P(2, 4)= mx{+2, 2} = 22 P(, 4)= mx{2+,22}= P(4, 4)= mx{5+2, }= P(2, 5)= mx{+2, 2} = 22 P(4, 5)= mx{2+2,22}=2 P(4, 5)= mx{5+22, 2}=7 6/2/24 Lecture COSCA 5 Reconstructing the Optiml Solution Item 4 Item 2 Item Strt t P(n, W) When ou go left- up item i hs een tken When ou go stright up item i hs not een tken 6/2/24 Lecture COSCA 6 Optiml Sustructure Overlpping Suprolems Consider the most vlule lod tht weights t most W pounds If we remove item j from this lod The remining lod must e the most vlule lod weighing t most W w j tht cn e tken from the remining n items 6/2/24 Lecture COSCA 7 P(i, w) = mx {v i + P(i-, w- w i ), P(i-, w) } i- i : w W n E.g.: ll the suprolems shown in gre m depend on P(i-, w) 6/2/24 Lecture COSCA 8

4 Huffmn Codes Huffmn Codes Widel used technique for dt compression Ide: Use the frequencies of occurrence of chrcters to Assume the dt to e sequence of chrcters Looking for n effective w of storing the dt uild optiml w of representing ech chrcter Frequenc (thousnds) 45 Binr chrcter code Uniquel represents chrcter inr string c 2 d 6 e f 5 6/2/24 Lecture COSCA 6/2/24 Lecture COSCA 2 Fixed-Length Codes E.g.: Dt file contining, chrcters Vrile-Length Codes E.g.: Dt file contining, chrcters Frequenc (thousnds) 45 c 2 d 6 e f 5 Frequenc (thousnds) 45 c 2 d 6 e f 5 its needed =, =, c =, d =, e =, f = Requires:, =, its Assign short codewords to frequent chrcters nd long codewords to infrequent chrcters =, =, c =, d =, e =, f = ( ), = 224, its 6/2/24 Lecture COSCA 2 6/2/24 Lecture COSCA 22 Prefix Codes Encoding with Binr Chrcter Codes Prefix codes: Codes for which no codeword is lso prefix of some other codeword Better nme would e prefix-free codes We cn chieve optiml dt compression using prefix codes Encoding Conctente the codewords representing ech chrcter in the file E.g.: =, =, c =, d =, e =, f = c = = We will restrict our ttention to prefix codes 6/2/24 Lecture COSCA 2 6/2/24 Lecture COSCA 24

5 Decoding with Binr Chrcter Codes Prefix codes simplif decoding No codeword is prefix of nother the codeword tht egins n encoded file is unmiguous Approch Identif the initil codeword Trnslte it ck to the originl chrcter Repet the process on the reminder of the file E.g.: =, =, c =, d =, e =, f = = = e 6/2/24 Lecture COSCA 25 Prefix Code Representtion Binr tree whose leves re the given chrcters Binr codeword the pth from the root to the chrcter, where mens go to the left child nd mens go to the right child Length of the codeword Length of the pth from root to the chrcter lef (depth of node) : 45 : c: 2 d: 6 e: f: 5 : 45 c: 2 : /2/24 Lecture COSCA f: 5 e: 26 4 d: 6 Optiml Codes An optiml code is lws represented full inr tree Ever non-lef hs two children Fixed-length code is not optiml, vrile-length is How mn its re required to encode file? Let C e the lphet of chrcters Let f(c) e the frequenc of chrcter c Let d T (c) e the depth of c s lef in the tree T corresponding to prefix code B ( T ) = f ( c) d ( c) the cost of tree T T c C 6/2/24 Lecture COSCA 27 Constructing Huffmn Code A greed lgorithm tht constructs n optiml prefix code clled Huffmn code Assume tht: C is set of n chrcters Ech chrcter hs frequenc f(c) The tree T is uilt in ottom up mnner Ide: f: 5 e: c: 2 : d: 6 : 45 Strt with set of C leves At ech step, merge the two lest frequent ojects: the frequenc of the new node = sum of two frequencies Use min-priorit queue Q, keed on f to identif the two lest frequent ojects 6/2/24 Lecture COSCA 28 Exmple f: 5 e: c: 2 : d: 6 : 45 c: 2 : 4 d: 6 : 45 f: 5 e: 4 d: 6 25 : : 45 f: 5 e: c: 2 : c: 2 : 4 d: 6 f: 5 e: : : c: 2 : 4 d: 6 c: 2 : 4 d: 6 f: 5 e: 6/2/24 Lecture COSCA f: 5 e: 2 Building Huffmn Code Alg.: HUFFMAN(C) Running time: O(nlgn). n C 2. Q C O(n). for i to n 4. do llocte new node z 5. left[z] x EXTRACT- MIN(Q) 6. right[z] EXTRACT- MIN(Q) O(nlgn) 7. f[z] f[x] + f[] 8. INSERT (Q, z). return EXTRACT- MIN(Q) 6/2/24 Lecture COSCA

6 Greed Choice Propert Lemm: Let C e n lphet in which ech chrcter c C hs frequenc f[c]. Let x nd e two chrcters in C hving the lowest frequencies. Then, there exists n optiml prefix code for C in which the codewords for x nd hve the sme length nd differ onl in the lst it. Proof of the Greed Choice Ide: Consider tree T representing n ritrr optiml prefix code Modif T to mke tree representing nother optiml prefix code in which x nd will pper s siling leves of mximum depth The codes of x nd will hve the sme length nd differ onl in the lst it 6/2/24 Lecture COSCA 6/2/24 Lecture COSCA 2 Proof of the Greed Choice (cont.) Proof of the Greed Choice (cont.) T T T x x x, two chrcters, siling leves of mximum depth in T Assume: f[] f[] nd f[x] f[] f[x] nd f[] re the two lowest lef frequencies, in order f[x] f[] nd f[] f[] Exchnge the positions of nd x (T ) nd of nd (T ) 6/2/24 Lecture COSCA T T T x B(T) B(T ) = f ( c) dt ( c) f ( c) dt '( c) c C c C = f[x]d T (x) + f[]d T () f[x]d T (x) f[]d T () = f[x]d T (x) + f[]d T () f[x]d T () f[]d T (x) = (f[] - f[x]) (d T () - d T (x)) x is minimum frequenc lef x 6/2/24 Lecture COSCA 4 is lef of mximum depth x Proof of the Greed Choice (cont.) Discussion T T T x x x B(T) B(T ) Similrl, exchnging nd does not increse the cost B(T ) B(T ) B(T ) B(T) nd since T is optiml B(T) B(T ) B(T) = B(T ) T is n optiml tree, in which x nd re siling leves of mximum depth 6/2/24 Lecture COSCA 5 Greed choice propert: Building n optiml tree mergers cn egin with the greed choice: merging the two chrcters with the lowest frequencies The cost of ech merger is the sum of frequencies of the two items eing merged Of ll possile mergers, HUFFMAN chooses the one tht incurs the lest cost 6/2/24 Lecture COSCA 6

7 Grphs Applictions tht involve not onl set of items, ut lso the connections etween them Mps Hpertexts Circuits Schedules Trnsctions Mtching Computer Networks 6/2/24 Lecture COSCA 7 Grphs - Bckground Grphs = set of nodes (vertices) with edges (links) etween them. Nottions: G = (V, E) - grph V = set of vertices V = n E = set of edges E = m 4 Directed grph 4 Undirected grph 4 Acclic grph 6/2/24 Lecture COSCA 8 Other Tpes of Grphs Grph Representtion A grph is connected if there is pth etween ever two vertices A iprtite grph is n undirected grph G = (V, E) in which V = V + V 2 nd there re edges onl etween vertices in V nd V Connected Not connected Adjcenc list representtion of G = (V, E) An rr of V lists, one for ech vertex in V Ech list Adj[u] contins ll the vertices v such tht there is n edge etween u nd v Adj[u] contins the vertices djcent to u (in ritrr order) Cn e used for oth directed nd undirected grphs Undirected grph / 5 4 / / 4 6/2/24 Lecture COSCA 6/2/24 Lecture COSCA 4 Properties of Adjcenc-List Representtion Sum of the lengths of ll the djcenc lists Directed grph: E Edge (u, v) ppers onl once in u s list Undirected grph: 2 E u nd v pper in ech other s djcenc lists: edge (u, v) ppers twice 4 Directed grph Undirected grph 6/2/24 Lecture COSCA 4 Properties of Adjcenc-List Representtion Memor required Θ(V + E) Preferred when the grph is sprse: E << V 2 Disdvntge no quick w to determine whether there is n edge etween node u nd v Time to list ll vertices djcent to u: Θ(degree(u)) Time to determine if (u, v) E: O(degree(u)) Undirected grph 4 Directed grph 6/2/24 Lecture COSCA 42

8 Grph Representtion Adjcenc mtrix representtion of G = (V, E) Assume vertices re numered, 2, V The representtion consists of mtrix A V x V : ij = if (i, j) E otherwise Undirected grph Mtrix A is smmetric: ij = ji A = A T 6/2/24 Lecture COSCA 4 Properties of Adjcenc Mtrix Representtion Memor required Θ(V 2 ), independent on the numer of edges in G Preferred when The grph is dense E is close to V 2 We need to quickl determine if there is n edge etween two vertices Time to list ll vertices djcent to u: Θ(V) Time to determine if (u, v) E: Θ() 6/2/24 Lecture COSCA 44 Weighted Grphs Weighted grphs = grphs for which ech edge hs n ssocited weight w(u, v) w: E R, weight function Storing the weights of grph Adjcenc list: Store w(u,v) long with vertex v in u s djcenc list Adjcenc mtrix: Store w(u, v) t loction (u, v) in the mtrix Serching in Grph Grph serching = sstemticll follow the edges of the grph so s to visit the vertices of the grph Two sic grph serching lgorithms: Bredth-first serch Depth-first serch The difference etween them is in the order in which the explore the unvisited edges of the grph Grph lgorithms re tpicll elortions of the sic grph- serching lgorithms 6/2/24 Lecture COSCA 45 6/2/24 Lecture COSCA 46 Bredth-First Serch (BFS) Input: A grph G = (V, E) (directed or undirected) A source vertex s V Gol: Explore the edges of G to discover ever vertex rechle from s, tking the ones closest to s first Output: d[v] = distnce (smllest # of edges) from s to v, for ll v V A redth-first tree rooted t s tht contins ll rechle vertices 6/2/24 Lecture COSCA 47 Bredth-First Serch (cont.) Discover vertices in incresing order of distnce from the source s serch in redth not depth Find ll vertices t edge from s, then ll vertices t 2 edges from s, nd so on /2/24 Lecture COSCA 48 2

9 Bredth-First Serch (cont.) Bredth-First Tree Keeping trck of progress: Color ech vertex in either white, gr or lck Initill, ll vertices re white When eing discovered vertex ecomes gr After discovering ll its djcent vertices the node ecomes lck Use FIFO queue Q to mintin the set of gr vertices source BFS constructs redth- first tree Initill contins the root (source vertex s) When vertex v is discovered while scnning the djcenc list of vertex u vertex v nd edge (u, v) re dded to the tree u is the predecessor (prent) of v in the redth-first tree A vertex is discovered onl once it hs t most one prent source 6/2/24 Lecture COSCA 4 6/2/24 Lecture COSCA 5 BFS Additionl Dt Structures BFS(G, s) G = (V, E) represented using djcenc lists. for ech u V[G] - {s} color[u] the color of the vertex for ll u V source d= π[u] predecessor of u If u = s (root) or node u hs not et een π= 2 discovered π[u] = NIL d[u] the distnce from the source s to vertex u d= d=2 π= π=5 Use FIFO queue Q to mintin the set of gr vertices d=2 π=2 2. do color[u] WHITE. d[u] 4. π[u] = NIL 5. color[s] GRAY 6. d[s] 7. π[s] = NIL 8. Q. Q ENQUEUE(Q, s) Q: s 6/2/24 Lecture COSCA 5 6/2/24 Lecture COSCA 52 BFS(V, E, s). while Q Q: s. do u DEQUEUE(Q) 2. for ech v Adj[u]. do if color[v] = WHITE Q: w 4. then color[v] GRAY 5. d[v] d[u] + 6. π[v] = u 7. ENQUEUE(Q, v) Q: w, r 8. color[u] BLACK 6/2/24 Lecture COSCA 5 Q: s 2 2 Q: t, x, v 2 Exmple Q: w, r 2 2 Q: x, v, u 2 2 Q: r, t, x 2 2 Q: v, u, Q: 6/2/24 u, Lecture Q: COSCA Q: 54

10 Anlsis of BFS. for ech u V - {s} 2. do color[u] WHITE O(V). d[u] 4. π[u] = NIL 5. color[s] GRAY 6. d[s] 7. π[s] = NIL Θ() 8. Q. Q ENQUEUE(Q, s) 6/2/24 Lecture COSCA 55 Anlsis of BFS. while Q. do u DEQUEUE(Q) 2. for ech v Adj[u]. do if color[v] = WHITE 4. then color[v] = GRAY Θ() 5. d[v] d[u] + 6. π[v] = u 7. ENQUEUE(Q, v) Θ() 8. color[u] BLACK Totl running time for BFS = O(V + E) Scn Adj[u] for ll vertices in the grph Ech vertex is scnned onl once, when the vertex is dequeued Sum of lengths of ll djcenc lists = Θ(E) Scnning opertions: O(E) 6/2/24 Lecture COSCA 56 Shortest Pths Propert BFS finds the shortest- pth distnce from the source vertex s V to ech node in the grph Shortest- pth distnce = δ(s, u) Minimum numer of edges in n pth from s to u Chpter 6 Chpter 22 Redings source 2 2 6/2/24 Lecture COSCA 57 6/2/24 Lecture COSCA 58

Preview 11/1/2017. Greedy Algorithms. Coin Change. Coin Change. Coin Change. Coin Change. Greedy algorithms. Greedy Algorithms

Preview 11/1/2017. Greedy Algorithms. Coin Change. Coin Change. Coin Change. Coin Change. Greedy algorithms. Greedy Algorithms Preview Greed Algorithms Greed Algorithms Coin Chnge Huffmn Code Greed lgorithms end to e simple nd strightforwrd. Are often used to solve optimiztion prolems. Alws mke the choice tht looks est t the moment,

More information

Connected-components. Summary of lecture 9. Algorithms and Data Structures Disjoint sets. Example: connected components in graphs

Connected-components. Summary of lecture 9. Algorithms and Data Structures Disjoint sets. Example: connected components in graphs Prm University, Mth. Deprtment Summry of lecture 9 Algorithms nd Dt Structures Disjoint sets Summry of this lecture: (CLR.1-3) Dt Structures for Disjoint sets: Union opertion Find opertion Mrco Pellegrini

More information

Data Structures LECTURE 10. Huffman coding. Example. Coding: problem definition

Data Structures LECTURE 10. Huffman coding. Example. Coding: problem definition Dt Strutures, Spring 24 L. Joskowiz Dt Strutures LEURE Humn oing Motivtion Uniquel eipherle oes Prei oes Humn oe onstrution Etensions n pplitions hpter 6.3 pp 385 392 in tetook Motivtion Suppose we wnt

More information

The Minimum Label Spanning Tree Problem: Illustrating the Utility of Genetic Algorithms

The Minimum Label Spanning Tree Problem: Illustrating the Utility of Genetic Algorithms The Minimum Lel Spnning Tree Prolem: Illustrting the Utility of Genetic Algorithms Yupei Xiong, Univ. of Mrylnd Bruce Golden, Univ. of Mrylnd Edwrd Wsil, Americn Univ. Presented t BAE Systems Distinguished

More information

Convert the NFA into DFA

Convert the NFA into DFA Convert the NF into F For ech NF we cn find F ccepting the sme lnguge. The numer of sttes of the F could e exponentil in the numer of sttes of the NF, ut in prctice this worst cse occurs rrely. lgorithm:

More information

p-adic Egyptian Fractions

p-adic Egyptian Fractions p-adic Egyptin Frctions Contents 1 Introduction 1 2 Trditionl Egyptin Frctions nd Greedy Algorithm 2 3 Set-up 3 4 p-greedy Algorithm 5 5 p-egyptin Trditionl 10 6 Conclusion 1 Introduction An Egyptin frction

More information

First Midterm Examination

First Midterm Examination 24-25 Fll Semester First Midterm Exmintion ) Give the stte digrm of DFA tht recognizes the lnguge A over lphet Σ = {, } where A = {w w contins or } 2) The following DFA recognizes the lnguge B over lphet

More information

CS 373, Spring Solutions to Mock midterm 1 (Based on first midterm in CS 273, Fall 2008.)

CS 373, Spring Solutions to Mock midterm 1 (Based on first midterm in CS 273, Fall 2008.) CS 373, Spring 29. Solutions to Mock midterm (sed on first midterm in CS 273, Fll 28.) Prolem : Short nswer (8 points) The nswers to these prolems should e short nd not complicted. () If n NF M ccepts

More information

1 Nondeterministic Finite Automata

1 Nondeterministic Finite Automata 1 Nondeterministic Finite Automt Suppose in life, whenever you hd choice, you could try oth possiilities nd live your life. At the end, you would go ck nd choose the one tht worked out the est. Then you

More information

Regular expressions, Finite Automata, transition graphs are all the same!!

Regular expressions, Finite Automata, transition graphs are all the same!! CSI 3104 /Winter 2011: Introduction to Forml Lnguges Chpter 7: Kleene s Theorem Chpter 7: Kleene s Theorem Regulr expressions, Finite Automt, trnsition grphs re ll the sme!! Dr. Neji Zgui CSI3104-W11 1

More information

Review of Gaussian Quadrature method

Review of Gaussian Quadrature method Review of Gussin Qudrture method Nsser M. Asi Spring 006 compiled on Sundy Decemer 1, 017 t 09:1 PM 1 The prolem To find numericl vlue for the integrl of rel vlued function of rel vrile over specific rnge

More information

DATA Search I 魏忠钰. 复旦大学大数据学院 School of Data Science, Fudan University. March 7 th, 2018

DATA Search I 魏忠钰. 复旦大学大数据学院 School of Data Science, Fudan University. March 7 th, 2018 DATA620006 魏忠钰 Serch I Mrch 7 th, 2018 Outline Serch Problems Uninformed Serch Depth-First Serch Bredth-First Serch Uniform-Cost Serch Rel world tsk - Pc-mn Serch problems A serch problem consists of:

More information

First Midterm Examination

First Midterm Examination Çnky University Deprtment of Computer Engineering 203-204 Fll Semester First Midterm Exmintion ) Design DFA for ll strings over the lphet Σ = {,, c} in which there is no, no nd no cc. 2) Wht lnguge does

More information

CS 310 (sec 20) - Winter Final Exam (solutions) SOLUTIONS

CS 310 (sec 20) - Winter Final Exam (solutions) SOLUTIONS CS 310 (sec 20) - Winter 2003 - Finl Exm (solutions) SOLUTIONS 1. (Logic) Use truth tles to prove the following logicl equivlences: () p q (p p) (q q) () p q (p q) (p q) () p q p q p p q q (q q) (p p)

More information

Lecture 2: January 27

Lecture 2: January 27 CS 684: Algorithmic Gme Theory Spring 217 Lecturer: Év Trdos Lecture 2: Jnury 27 Scrie: Alert Julius Liu 2.1 Logistics Scrie notes must e sumitted within 24 hours of the corresponding lecture for full

More information

Finite Automata-cont d

Finite Automata-cont d Automt Theory nd Forml Lnguges Professor Leslie Lnder Lecture # 6 Finite Automt-cont d The Pumping Lemm WEB SITE: http://ingwe.inghmton.edu/ ~lnder/cs573.html Septemer 18, 2000 Exmple 1 Consider L = {ww

More information

CS 188: Artificial Intelligence Spring 2007

CS 188: Artificial Intelligence Spring 2007 CS 188: Artificil Intelligence Spring 2007 Lecture 3: Queue-Bsed Serch 1/23/2007 Srini Nrynn UC Berkeley Mny slides over the course dpted from Dn Klein, Sturt Russell or Andrew Moore Announcements Assignment

More information

4. GREEDY ALGORITHMS I

4. GREEDY ALGORITHMS I 4. GREEDY ALGORITHMS I coin chnging intervl scheduling scheduling to minimize lteness optiml cching Lecture slides by Kevin Wyne Copyright 2005 Person-Addison Wesley http://www.cs.princeton.edu/~wyne/kleinberg-trdos

More information

Homework 3 Solutions

Homework 3 Solutions CS 341: Foundtions of Computer Science II Prof. Mrvin Nkym Homework 3 Solutions 1. Give NFAs with the specified numer of sttes recognizing ech of the following lnguges. In ll cses, the lphet is Σ = {,1}.

More information

Section 4: Integration ECO4112F 2011

Section 4: Integration ECO4112F 2011 Reding: Ching Chpter Section : Integrtion ECOF Note: These notes do not fully cover the mteril in Ching, ut re ment to supplement your reding in Ching. Thus fr the optimistion you hve covered hs een sttic

More information

Uninformed Search Lecture 4

Uninformed Search Lecture 4 Lecture 4 Wht re common serch strtegies tht operte given only serch problem? How do they compre? 1 Agend A quick refresher DFS, BFS, ID-DFS, UCS Unifiction! 2 Serch Problem Formlism Defined vi the following

More information

Introduction to Algebra - Part 2

Introduction to Algebra - Part 2 Alger Module A Introduction to Alger - Prt Copright This puliction The Northern Alert Institute of Technolog 00. All Rights Reserved. LAST REVISED Oct., 008 Introduction to Alger - Prt Sttement of Prerequisite

More information

CS 275 Automata and Formal Language Theory

CS 275 Automata and Formal Language Theory CS 275 utomt nd Forml Lnguge Theory Course Notes Prt II: The Recognition Prolem (II) Chpter II.5.: Properties of Context Free Grmmrs (14) nton Setzer (Bsed on ook drft y J. V. Tucker nd K. Stephenson)

More information

CS415 Compilers. Lexical Analysis and. These slides are based on slides copyrighted by Keith Cooper, Ken Kennedy & Linda Torczon at Rice University

CS415 Compilers. Lexical Analysis and. These slides are based on slides copyrighted by Keith Cooper, Ken Kennedy & Linda Torczon at Rice University CS415 Compilers Lexicl Anlysis nd These slides re sed on slides copyrighted y Keith Cooper, Ken Kennedy & Lind Torczon t Rice University First Progrmming Project Instruction Scheduling Project hs een posted

More information

Designing finite automata II

Designing finite automata II Designing finite utomt II Prolem: Design DFA A such tht L(A) consists of ll strings of nd which re of length 3n, for n = 0, 1, 2, (1) Determine wht to rememer out the input string Assign stte to ech of

More information

19 Optimal behavior: Game theory

19 Optimal behavior: Game theory Intro. to Artificil Intelligence: Dle Schuurmns, Relu Ptrscu 1 19 Optiml behvior: Gme theory Adversril stte dynmics hve to ccount for worst cse Compute policy π : S A tht mximizes minimum rewrd Let S (,

More information

7.1 Integral as Net Change and 7.2 Areas in the Plane Calculus

7.1 Integral as Net Change and 7.2 Areas in the Plane Calculus 7.1 Integrl s Net Chnge nd 7. Ares in the Plne Clculus 7.1 INTEGRAL AS NET CHANGE Notecrds from 7.1: Displcement vs Totl Distnce, Integrl s Net Chnge We hve lredy seen how the position of n oject cn e

More information

Surface maps into free groups

Surface maps into free groups Surfce mps into free groups lden Wlker Novemer 10, 2014 Free groups wedge X of two circles: Set F = π 1 (X ) =,. We write cpitl letters for inverse, so = 1. e.g. () 1 = Commuttors Let x nd y e loops. The

More information

I1 = I2 I1 = I2 + I3 I1 + I2 = I3 + I4 I 3

I1 = I2 I1 = I2 + I3 I1 + I2 = I3 + I4 I 3 2 The Prllel Circuit Electric Circuits: Figure 2- elow show ttery nd multiple resistors rrnged in prllel. Ech resistor receives portion of the current from the ttery sed on its resistnce. The split is

More information

Bridging the gap: GCSE AS Level

Bridging the gap: GCSE AS Level Bridging the gp: GCSE AS Level CONTENTS Chpter Removing rckets pge Chpter Liner equtions Chpter Simultneous equtions 8 Chpter Fctors 0 Chpter Chnge the suject of the formul Chpter 6 Solving qudrtic equtions

More information

M344 - ADVANCED ENGINEERING MATHEMATICS

M344 - ADVANCED ENGINEERING MATHEMATICS M3 - ADVANCED ENGINEERING MATHEMATICS Lecture 18: Lplce s Eqution, Anltic nd Numericl Solution Our emple of n elliptic prtil differentil eqution is Lplce s eqution, lso clled the Diffusion Eqution. If

More information

1. For each of the following theorems, give a two or three sentence sketch of how the proof goes or why it is not true.

1. For each of the following theorems, give a two or three sentence sketch of how the proof goes or why it is not true. York University CSE 2 Unit 3. DFA Clsses Converting etween DFA, NFA, Regulr Expressions, nd Extended Regulr Expressions Instructor: Jeff Edmonds Don t chet y looking t these nswers premturely.. For ech

More information

Lecture 08: Feb. 08, 2019

Lecture 08: Feb. 08, 2019 4CS4-6:Theory of Computtion(Closure on Reg. Lngs., regex to NDFA, DFA to regex) Prof. K.R. Chowdhry Lecture 08: Fe. 08, 2019 : Professor of CS Disclimer: These notes hve not een sujected to the usul scrutiny

More information

Tries and suffixes trees

Tries and suffixes trees Trie: A dt-structure for set of words Tries nd suffixes trees Alon Efrt Comuter Science Dertment University of Arizon All words over the lhet Σ={,,..z}. In the slides, let sy tht the lhet is only {,,c,d}

More information

Chapter 2 Finite Automata

Chapter 2 Finite Automata Chpter 2 Finite Automt 28 2.1 Introduction Finite utomt: first model of the notion of effective procedure. (They lso hve mny other pplictions). The concept of finite utomton cn e derived y exmining wht

More information

2.4 Linear Inequalities and Interval Notation

2.4 Linear Inequalities and Interval Notation .4 Liner Inequlities nd Intervl Nottion We wnt to solve equtions tht hve n inequlity symol insted of n equl sign. There re four inequlity symols tht we will look t: Less thn , Less thn or

More information

Intermediate Math Circles Wednesday, November 14, 2018 Finite Automata II. Nickolas Rollick a b b. a b 4

Intermediate Math Circles Wednesday, November 14, 2018 Finite Automata II. Nickolas Rollick a b b. a b 4 Intermedite Mth Circles Wednesdy, Novemer 14, 2018 Finite Automt II Nickols Rollick nrollick@uwterloo.c Regulr Lnguges Lst time, we were introduced to the ide of DFA (deterministic finite utomton), one

More information

CS103B Handout 18 Winter 2007 February 28, 2007 Finite Automata

CS103B Handout 18 Winter 2007 February 28, 2007 Finite Automata CS103B ndout 18 Winter 2007 Ferury 28, 2007 Finite Automt Initil text y Mggie Johnson. Introduction Severl childrens gmes fit the following description: Pieces re set up on plying ord; dice re thrown or

More information

Calculus Module C21. Areas by Integration. Copyright This publication The Northern Alberta Institute of Technology All Rights Reserved.

Calculus Module C21. Areas by Integration. Copyright This publication The Northern Alberta Institute of Technology All Rights Reserved. Clculus Module C Ares Integrtion Copright This puliction The Northern Alert Institute of Technolog 7. All Rights Reserved. LAST REVISED Mrch, 9 Introduction to Ares Integrtion Sttement of Prerequisite

More information

Minimal DFA. minimal DFA for L starting from any other

Minimal DFA. minimal DFA for L starting from any other Miniml DFA Among the mny DFAs ccepting the sme regulr lnguge L, there is exctly one (up to renming of sttes) which hs the smllest possile numer of sttes. Moreover, it is possile to otin tht miniml DFA

More information

CS 301. Lecture 04 Regular Expressions. Stephen Checkoway. January 29, 2018

CS 301. Lecture 04 Regular Expressions. Stephen Checkoway. January 29, 2018 CS 301 Lecture 04 Regulr Expressions Stephen Checkowy Jnury 29, 2018 1 / 35 Review from lst time NFA N = (Q, Σ, δ, q 0, F ) where δ Q Σ P (Q) mps stte nd n lphet symol (or ) to set of sttes We run n NFA

More information

Bases for Vector Spaces

Bases for Vector Spaces Bses for Vector Spces 2-26-25 A set is independent if, roughly speking, there is no redundncy in the set: You cn t uild ny vector in the set s liner comintion of the others A set spns if you cn uild everything

More information

Coalgebra, Lecture 15: Equations for Deterministic Automata

Coalgebra, Lecture 15: Equations for Deterministic Automata Colger, Lecture 15: Equtions for Deterministic Automt Julin Slmnc (nd Jurrin Rot) Decemer 19, 2016 In this lecture, we will study the concept of equtions for deterministic utomt. The notes re self contined

More information

Alignment of Long Sequences. BMI/CS Spring 2016 Anthony Gitter

Alignment of Long Sequences. BMI/CS Spring 2016 Anthony Gitter Alignment of Long Sequences BMI/CS 776 www.biostt.wisc.edu/bmi776/ Spring 2016 Anthony Gitter gitter@biostt.wisc.edu Gols for Lecture Key concepts how lrge-scle lignment differs from the simple cse the

More information

Designing Information Devices and Systems I Spring 2018 Homework 7

Designing Information Devices and Systems I Spring 2018 Homework 7 EECS 16A Designing Informtion Devices nd Systems I Spring 2018 omework 7 This homework is due Mrch 12, 2018, t 23:59. Self-grdes re due Mrch 15, 2018, t 23:59. Sumission Formt Your homework sumission should

More information

10 Vector Integral Calculus

10 Vector Integral Calculus Vector Integrl lculus Vector integrl clculus extends integrls s known from clculus to integrls over curves ("line integrls"), surfces ("surfce integrls") nd solids ("volume integrls"). These integrls hve

More information

Signal Flow Graphs. Consider a complex 3-port microwave network, constructed of 5 simpler microwave devices:

Signal Flow Graphs. Consider a complex 3-port microwave network, constructed of 5 simpler microwave devices: 3/3/009 ignl Flow Grphs / ignl Flow Grphs Consider comple 3-port microwve network, constructed of 5 simpler microwve devices: 3 4 5 where n is the scttering mtri of ech device, nd is the overll scttering

More information

CSCI 340: Computational Models. Transition Graphs. Department of Computer Science

CSCI 340: Computational Models. Transition Graphs. Department of Computer Science CSCI 340: Computtionl Models Trnsition Grphs Chpter 6 Deprtment of Computer Science Relxing Restrints on Inputs We cn uild n FA tht ccepts only the word! 5 sttes ecuse n FA cn only process one letter t

More information

The size of subsequence automaton

The size of subsequence automaton Theoreticl Computer Science 4 (005) 79 84 www.elsevier.com/locte/tcs Note The size of susequence utomton Zdeněk Troníček,, Ayumi Shinohr,c Deprtment of Computer Science nd Engineering, FEE CTU in Prgue,

More information

Parse trees, ambiguity, and Chomsky normal form

Parse trees, ambiguity, and Chomsky normal form Prse trees, miguity, nd Chomsky norml form In this lecture we will discuss few importnt notions connected with contextfree grmmrs, including prse trees, miguity, nd specil form for context-free grmmrs

More information

Designing Information Devices and Systems I Discussion 8B

Designing Information Devices and Systems I Discussion 8B Lst Updted: 2018-10-17 19:40 1 EECS 16A Fll 2018 Designing Informtion Devices nd Systems I Discussion 8B 1. Why Bother With Thévenin Anywy? () Find Thévenin eqiuvlent for the circuit shown elow. 2kΩ 5V

More information

LINEAR ALGEBRA APPLIED

LINEAR ALGEBRA APPLIED 5.5 Applictions of Inner Product Spces 5.5 Applictions of Inner Product Spces 7 Find the cross product of two vectors in R. Find the liner or qudrtic lest squres pproimtion of function. Find the nth-order

More information

Java II Finite Automata I

Java II Finite Automata I Jv II Finite Automt I Bernd Kiefer Bernd.Kiefer@dfki.de Deutsches Forschungszentrum für künstliche Intelligenz Finite Automt I p.1/13 Processing Regulr Expressions We lredy lerned out Jv s regulr expression

More information

Lecture 3. In this lecture, we will discuss algorithms for solving systems of linear equations.

Lecture 3. In this lecture, we will discuss algorithms for solving systems of linear equations. Lecture 3 3 Solving liner equtions In this lecture we will discuss lgorithms for solving systems of liner equtions Multiplictive identity Let us restrict ourselves to considering squre mtrices since one

More information

CMSC 330: Organization of Programming Languages

CMSC 330: Organization of Programming Languages CMSC 330: Orgniztion of Progrmming Lnguges Finite Automt 2 CMSC 330 1 Types of Finite Automt Deterministic Finite Automt (DFA) Exctly one sequence of steps for ech string All exmples so fr Nondeterministic

More information

Where did dynamic programming come from?

Where did dynamic programming come from? Where did dynmic progrmming come from? String lgorithms Dvid Kuchk cs302 Spring 2012 Richrd ellmn On the irth of Dynmic Progrmming Sturt Dreyfus http://www.eng.tu.c.il/~mi/cd/ or50/1526-5463-2002-50-01-0048.pdf

More information

Lecture 3: Equivalence Relations

Lecture 3: Equivalence Relations Mthcmp Crsh Course Instructor: Pdric Brtlett Lecture 3: Equivlence Reltions Week 1 Mthcmp 2014 In our lst three tlks of this clss, we shift the focus of our tlks from proof techniques to proof concepts

More information

Chapter 9 Definite Integrals

Chapter 9 Definite Integrals Chpter 9 Definite Integrls In the previous chpter we found how to tke n ntiderivtive nd investigted the indefinite integrl. In this chpter the connection etween ntiderivtives nd definite integrls is estlished

More information

Interpreting Integrals and the Fundamental Theorem

Interpreting Integrals and the Fundamental Theorem Interpreting Integrls nd the Fundmentl Theorem Tody, we go further in interpreting the mening of the definite integrl. Using Units to Aid Interprettion We lredy know tht if f(t) is the rte of chnge of

More information

Formal languages, automata, and theory of computation

Formal languages, automata, and theory of computation Mälrdlen University TEN1 DVA337 2015 School of Innovtion, Design nd Engineering Forml lnguges, utomt, nd theory of computtion Thursdy, Novemer 5, 14:10-18:30 Techer: Dniel Hedin, phone 021-107052 The exm

More information

Farey Fractions. Rickard Fernström. U.U.D.M. Project Report 2017:24. Department of Mathematics Uppsala University

Farey Fractions. Rickard Fernström. U.U.D.M. Project Report 2017:24. Department of Mathematics Uppsala University U.U.D.M. Project Report 07:4 Frey Frctions Rickrd Fernström Exmensrete i mtemtik, 5 hp Hledre: Andres Strömergsson Exmintor: Jörgen Östensson Juni 07 Deprtment of Mthemtics Uppsl University Frey Frctions

More information

Advanced Algebra & Trigonometry Midterm Review Packet

Advanced Algebra & Trigonometry Midterm Review Packet Nme Dte Advnced Alger & Trigonometry Midterm Review Pcket The Advnced Alger & Trigonometry midterm em will test your generl knowledge of the mteril we hve covered since the eginning of the school yer.

More information

Math 61CM - Solutions to homework 9

Math 61CM - Solutions to homework 9 Mth 61CM - Solutions to homework 9 Cédric De Groote November 30 th, 2018 Problem 1: Recll tht the left limit of function f t point c is defined s follows: lim f(x) = l x c if for ny > 0 there exists δ

More information

Linear Inequalities. Work Sheet 1

Linear Inequalities. Work Sheet 1 Work Sheet 1 Liner Inequlities Rent--Hep, cr rentl compny,chrges $ 15 per week plus $ 0.0 per mile to rent one of their crs. Suppose you re limited y how much money you cn spend for the week : You cn spend

More information

Fingerprint idea. Assume:

Fingerprint idea. Assume: Fingerprint ide Assume: We cn compute fingerprint f(p) of P in O(m) time. If f(p) f(t[s.. s+m 1]), then P T[s.. s+m 1] We cn compre fingerprints in O(1) We cn compute f = f(t[s+1.. s+m]) from f(t[s.. s+m

More information

MA123, Chapter 10: Formulas for integrals: integrals, antiderivatives, and the Fundamental Theorem of Calculus (pp.

MA123, Chapter 10: Formulas for integrals: integrals, antiderivatives, and the Fundamental Theorem of Calculus (pp. MA123, Chpter 1: Formuls for integrls: integrls, ntiderivtives, nd the Fundmentl Theorem of Clculus (pp. 27-233, Gootmn) Chpter Gols: Assignments: Understnd the sttement of the Fundmentl Theorem of Clculus.

More information

Balanced binary search trees

Balanced binary search trees 02110 Inge Li Gørtz Overview Blnced binry serch trees: Red-blck trees nd 2-3-4 trees Amortized nlysis Dynmic progrmming Network flows String mtching String indexing Computtionl geometry Introduction to

More information

Minnesota State University, Mankato 44 th Annual High School Mathematics Contest April 12, 2017

Minnesota State University, Mankato 44 th Annual High School Mathematics Contest April 12, 2017 Minnesot Stte University, Mnkto 44 th Annul High School Mthemtics Contest April, 07. A 5 ft. ldder is plced ginst verticl wll of uilding. The foot of the ldder rests on the floor nd is 7 ft. from the wll.

More information

This chapter will show you. What you should already know. 1 Write down the value of each of the following. a 5 2

This chapter will show you. What you should already know. 1 Write down the value of each of the following. a 5 2 1 Direct vrition 2 Inverse vrition This chpter will show you how to solve prolems where two vriles re connected y reltionship tht vries in direct or inverse proportion Direct proportion Inverse proportion

More information

Search: The Core of Planning

Search: The Core of Planning Serch: The Core of Plnning Dr. Neil T. Dntm CSCI-498/598 RPM, Colordo School of Mines Spring 208 Dntm (Mines CSCI, RPM) Serch Spring 208 / 75 Outline Plnning nd Serch Problems Bsic Serch Depth-First Serch

More information

AQA Further Pure 2. Hyperbolic Functions. Section 2: The inverse hyperbolic functions

AQA Further Pure 2. Hyperbolic Functions. Section 2: The inverse hyperbolic functions Hperbolic Functions Section : The inverse hperbolic functions Notes nd Emples These notes contin subsections on The inverse hperbolic functions Integrtion using the inverse hperbolic functions Logrithmic

More information

1. For each of the following theorems, give a two or three sentence sketch of how the proof goes or why it is not true.

1. For each of the following theorems, give a two or three sentence sketch of how the proof goes or why it is not true. York University CSE 2 Unit 3. DFA Clsses Converting etween DFA, NFA, Regulr Expressions, nd Extended Regulr Expressions Instructor: Jeff Edmonds Don t chet y looking t these nswers premturely.. For ech

More information

Types of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. NFA for (a b)*abb.

Types of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. NFA for (a b)*abb. CMSC 330: Orgniztion of Progrmming Lnguges Finite Automt 2 Types of Finite Automt Deterministic Finite Automt () Exctly one sequence of steps for ech string All exmples so fr Nondeterministic Finite Automt

More information

Types of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. Comparing DFAs and NFAs (cont.) Finite Automata 2

Types of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. Comparing DFAs and NFAs (cont.) Finite Automata 2 CMSC 330: Orgniztion of Progrmming Lnguges Finite Automt 2 Types of Finite Automt Deterministic Finite Automt () Exctly one sequence of steps for ech string All exmples so fr Nondeterministic Finite Automt

More information

State space systems analysis (continued) Stability. A. Definitions A system is said to be Asymptotically Stable (AS) when it satisfies

State space systems analysis (continued) Stability. A. Definitions A system is said to be Asymptotically Stable (AS) when it satisfies Stte spce systems nlysis (continued) Stbility A. Definitions A system is sid to be Asymptoticlly Stble (AS) when it stisfies ut () = 0, t > 0 lim xt () 0. t A system is AS if nd only if the impulse response

More information

Parsing and Pattern Recognition

Parsing and Pattern Recognition Topics in IT Prsing nd Pttern Recognition Week Context-Free Prsing College of Informtion Science nd Engineering Ritsumeikn University this week miguity in nturl lnguge in mchine lnguges top-down, redth-first

More information

Math 017. Materials With Exercises

Math 017. Materials With Exercises Mth 07 Mterils With Eercises Jul 0 TABLE OF CONTENTS Lesson Vriles nd lgeric epressions; Evlution of lgeric epressions... Lesson Algeric epressions nd their evlutions; Order of opertions....... Lesson

More information

We will see what is meant by standard form very shortly

We will see what is meant by standard form very shortly THEOREM: For fesible liner progrm in its stndrd form, the optimum vlue of the objective over its nonempty fesible region is () either unbounded or (b) is chievble t lest t one extreme point of the fesible

More information

(e) if x = y + z and a divides any two of the integers x, y, or z, then a divides the remaining integer

(e) if x = y + z and a divides any two of the integers x, y, or z, then a divides the remaining integer Divisibility In this note we introduce the notion of divisibility for two integers nd b then we discuss the division lgorithm. First we give forml definition nd note some properties of the division opertion.

More information

Lecture 9: LTL and Büchi Automata

Lecture 9: LTL and Büchi Automata Lecture 9: LTL nd Büchi Automt 1 LTL Property Ptterns Quite often the requirements of system follow some simple ptterns. Sometimes we wnt to specify tht property should only hold in certin context, clled

More information

How do we solve these things, especially when they get complicated? How do we know when a system has a solution, and when is it unique?

How do we solve these things, especially when they get complicated? How do we know when a system has a solution, and when is it unique? XII. LINEAR ALGEBRA: SOLVING SYSTEMS OF EQUATIONS Tody we re going to tlk out solving systems of liner equtions. These re prolems tht give couple of equtions with couple of unknowns, like: 6= x + x 7=

More information

Algorithm Design and Analysis

Algorithm Design and Analysis Algorithm Design nd Anlysis LECTURE 5 Supplement Greedy Algorithms Cont d Minimizing lteness Ching (NOT overed in leture) Adm Smith 9/8/10 A. Smith; sed on slides y E. Demine, C. Leiserson, S. Rskhodnikov,

More information

10.2 The Ellipse and the Hyperbola

10.2 The Ellipse and the Hyperbola CHAPTER 0 Conic Sections Solve. 97. Two surveors need to find the distnce cross lke. The plce reference pole t point A in the digrm. Point B is meters est nd meter north of the reference point A. Point

More information

Thoery of Automata CS402

Thoery of Automata CS402 Thoery of Automt C402 Theory of Automt Tle of contents: Lecture N0. 1... 4 ummry... 4 Wht does utomt men?... 4 Introduction to lnguges... 4 Alphets... 4 trings... 4 Defining Lnguges... 5 Lecture N0. 2...

More information

CS 275 Automata and Formal Language Theory

CS 275 Automata and Formal Language Theory CS 275 Automt nd Forml Lnguge Theory Course Notes Prt II: The Recognition Problem (II) Chpter II.5.: Properties of Context Free Grmmrs (14) Anton Setzer (Bsed on book drft by J. V. Tucker nd K. Stephenson)

More information

Random subgroups of a free group

Random subgroups of a free group Rndom sugroups of free group Frédérique Bssino LIPN - Lortoire d Informtique de Pris Nord, Université Pris 13 - CNRS Joint work with Armndo Mrtino, Cyril Nicud, Enric Ventur et Pscl Weil LIX My, 2015 Introduction

More information

NFAs continued, Closure Properties of Regular Languages

NFAs continued, Closure Properties of Regular Languages lgorithms & Models of omputtion S/EE 374, Spring 209 NFs continued, losure Properties of Regulr Lnguges Lecture 5 Tuesdy, Jnury 29, 209 Regulr Lnguges, DFs, NFs Lnguges ccepted y DFs, NFs, nd regulr expressions

More information

Chapter 6 Techniques of Integration

Chapter 6 Techniques of Integration MA Techniques of Integrtion Asst.Prof.Dr.Suprnee Liswdi Chpter 6 Techniques of Integrtion Recll: Some importnt integrls tht we hve lernt so fr. Tle of Integrls n+ n d = + C n + e d = e + C ( n ) d = ln

More information

Algorithms Booklet. 1 Graph Searching. 1.1 Breadth First Search

Algorithms Booklet. 1 Graph Searching. 1.1 Breadth First Search Algorithms Booklet 2010 Note: in all algorithms, unless stated otherwise, the input graph G is represented by adjacency lists. 1 Graph Searching 1.1 Breadth First Search Algorithm 1: BFS(G, s) Input: G

More information

Introduction to Electrical & Electronic Engineering ENGG1203

Introduction to Electrical & Electronic Engineering ENGG1203 Introduction to Electricl & Electronic Engineering ENGG23 2 nd Semester, 27-8 Dr. Hden Kwok-H So Deprtment of Electricl nd Electronic Engineering Astrction DIGITAL LOGIC 2 Digitl Astrction n Astrct ll

More information

1 ELEMENTARY ALGEBRA and GEOMETRY READINESS DIAGNOSTIC TEST PRACTICE

1 ELEMENTARY ALGEBRA and GEOMETRY READINESS DIAGNOSTIC TEST PRACTICE ELEMENTARY ALGEBRA nd GEOMETRY READINESS DIAGNOSTIC TEST PRACTICE Directions: Study the exmples, work the prolems, then check your nswers t the end of ech topic. If you don t get the nswer given, check

More information

CS 330 Formal Methods and Models Dana Richards, George Mason University, Spring 2016 Quiz Solutions

CS 330 Formal Methods and Models Dana Richards, George Mason University, Spring 2016 Quiz Solutions CS 330 Forml Methods nd Models Dn Richrds, George Mson University, Spring 2016 Quiz Solutions Quiz 1, Propositionl Logic Dte: Ferury 9 1. (4pts) ((p q) (q r)) (p r), prove tutology using truth tles. p

More information

Languages & Automata

Languages & Automata Lnguges & Automt Dr. Lim Nughton Lnguges A lnguge is sed on n lphet which is finite set of smols such s {, } or {, } or {,..., z}. If Σ is n lphet, string over Σ is finite sequence of letters from Σ, (strings

More information

Assignment 1 Automata, Languages, and Computability. 1 Finite State Automata and Regular Languages

Assignment 1 Automata, Languages, and Computability. 1 Finite State Automata and Regular Languages Deprtment of Computer Science, Austrlin Ntionl University COMP2600 Forml Methods for Softwre Engineering Semester 2, 206 Assignment Automt, Lnguges, nd Computility Smple Solutions Finite Stte Automt nd

More information

Section 6.1 Definite Integral

Section 6.1 Definite Integral Section 6.1 Definite Integrl Suppose we wnt to find the re of region tht is not so nicely shped. For exmple, consider the function shown elow. The re elow the curve nd ove the x xis cnnot e determined

More information

Definite Integrals. The area under a curve can be approximated by adding up the areas of rectangles = 1 1 +

Definite Integrals. The area under a curve can be approximated by adding up the areas of rectangles = 1 1 + Definite Integrls --5 The re under curve cn e pproximted y dding up the res of rectngles. Exmple. Approximte the re under y = from x = to x = using equl suintervls nd + x evluting the function t the left-hnd

More information

Closure Properties of Regular Languages

Closure Properties of Regular Languages Closure Properties of Regulr Lnguges Regulr lnguges re closed under mny set opertions. Let L 1 nd L 2 e regulr lnguges. (1) L 1 L 2 (the union) is regulr. (2) L 1 L 2 (the conctention) is regulr. (3) L

More information

CMPSCI 250: Introduction to Computation. Lecture #31: What DFA s Can and Can t Do David Mix Barrington 9 April 2014

CMPSCI 250: Introduction to Computation. Lecture #31: What DFA s Can and Can t Do David Mix Barrington 9 April 2014 CMPSCI 250: Introduction to Computtion Lecture #31: Wht DFA s Cn nd Cn t Do Dvid Mix Brrington 9 April 2014 Wht DFA s Cn nd Cn t Do Deterministic Finite Automt Forml Definition of DFA s Exmples of DFA

More information

Fast Frequent Free Tree Mining in Graph Databases

Fast Frequent Free Tree Mining in Graph Databases The Chinese University of Hong Kong Fst Frequent Free Tree Mining in Grph Dtses Peixing Zho Jeffrey Xu Yu The Chinese University of Hong Kong Decemer 18 th, 2006 ICDM Workshop MCD06 Synopsis Introduction

More information

Module 9: Tries and String Matching

Module 9: Tries and String Matching Module 9: Tries nd String Mtching CS 240 - Dt Structures nd Dt Mngement Sjed Hque Veronik Irvine Tylor Smith Bsed on lecture notes by mny previous cs240 instructors Dvid R. Cheriton School of Computer

More information