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

Size: px
Start display at page:

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

Transcription

1 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 in tetook Motivtion Suppose we wnt to store n trnsmit ver lrge iles messges onsisting o strings wors onstrute over n lphet o hrters letters. Representing eh hrter with ie-length oe will not result in the shortest possile ile! Emple: 8-it ASII oe or hrters some hrters re muh more requent thn others using shorter oes or requent hrters n longer ones or inrequent ones will result in shorter ile Dt Strutures, Spring 24 L. Joskowiz Frequen % Fie-length Vrile-length 45 Emple Messge: e A ile o, hrters tkes: 3, = 3, its with ie-length oe , = 224, its on verge with vrile-length oe % less Dt Strutures, Spring 24 L. Joskowiz e oing: prolem einition Represent the hrters rom n input lphet using vrile-length oe lphet, tking into ount the ourrene requen o the hrters. Desire properties: he oe must e uniquel eipherle: ever messge n e eoe in onl one w. he oe must e optiml with respet to the input proilit istriution. he oe must e eiientl eipherle prei oe: no string is prei o nother. Dt Strutures, Spring 24 L. Joskowiz Uniquel eipherle oes Deinition: he oe lphet = {, 2,, n } over the originl lphet is uniquel eipherle i ever messge onstrute rom oe-wors o n e roken own into oe-wors o in onl one w. Question: how n we test i is uniquel eipherle? Lemm: oe is uniquel eipherle i no til is oe-wor. Dt Strutures, Spring 24 L. Joskowiz erminolog Let w, p, n s e wors over the lphet. For w = ps, p is the prei n s is the sui o w. Let t e non-empt wor. t is lle til i there eist two messges 2 m n 2 n suh tht: i n j re oe-wors n i n, j m t is sui o n 2 m t = 2 n he length o wor w is lw. w is non-empt when lw >. l is the mimum length o oe-wor in. Dt Strutures, Spring 24 L. Joskowiz

2 Dt Strutures, Spring 24 L. Joskowiz Uniquel eipherle oes Proo: oe is uniquel eipherle UD i no til is oe-wor. I oe-wor is til then einition there eist two messges 2 m n 2 n whih stis 2 m = 2 n while hus there re two ws to interpret the messge. I is not UD, there eist messges whih n e interprete in more thn one w. Let µ e the shortest suh n miguous messge. hen µ = 2 k = 2 n tht is, ll i s n j s re oe-wors n. hus, without loss o generlit, k is sui o n k is til. est or unique eipherilit. For ever two oe-wors, i n j i j o: I i = j then hlt: is not UD. I or some wor s either i s = j or j s = i then put s in the set o tils 2. For ever til t in n ever oe-wor i in o: I t = j then hlt: is not UD. I or some wor s either ts = j or j s = t then put s in the set o tils. 3. Hlt: is UD. ime ompleit: On 2 l 2 Dt Strutures, Spring 24 L. Joskowiz Emple = {,,,,}. ils:. = t =. = t = 2. ils. = t = is UD Dt Strutures, Spring 24 L. Joskowiz Emple 2 = {,,,}. ils:. = t = 2. ils. = t =. = t =. = t = is oe-wor! is not UD ounter-emple: hs two menings:..... Dt Strutures, Spring 24 L. Joskowiz Dt Strutures, Spring 24 L. Joskowiz Prei oes We onsier onl prei oes: no oe-wor is prei o nother oe-wor. Prei oes re uniquel eipherle einition. A inr prei oe n e represente s inr tree: leves re oe-wors n their requen % internl noes re inr eision points: mens go to the let, mens go to the right o hrter. he inlue the sum o requenies o their hilren. he pth rom the root to the oe-wor is the inr representtion o the oe-wor. Emple: ie-length prei oe e Messge:... Dt Strutures, Spring 24 L. Joskowiz e

3 Emple: ie-length prei oe : e 9 5 Dt Strutures, Spring 24 L. Joskowiz Frequen % Emple: vrile-length prei oe Messge:... e e Dt Strutures, Spring 24 L. Joskowiz Emple: vrile-length prei oe : Frequen % 5 e 9 Dt Strutures, Spring 24 L. Joskowiz Optiml oing An optiml oe is represente s ull inr tree For oe lphet = {, 2,, n } with oewors, ll with positive requenies i >, the tree or n optiml prei oe hs etl leves n internl noes. Deinition: he ost o prei tree is eine s numer o its B require to enoe ll oe-wors B where is the epth in length o oe-wor. Dt Strutures, Spring 24 L. Joskowiz Emple Fie-length oe: Dt Strutures, Spring 24 L. Joskowiz Optiml oing = 3 Vrile-length oe: = 2.24 Optiml oe: the oe with the lowest ost: heorem: Optiml oing is hievle with prei oe. B min Humn oe: eoing Humn invente in 952 gree lgorithm or onstruting n optiml prei oe, lle Humn oe. Deoing:. Strt t the root o the oing tree, re input its. 2. Ater reing go let 3. Ater reing go right 4. I le noe hs een rehe, output the hrter store in the le, n return to the root o the tree. ompleit: On, where n is the messge length. Dt Strutures, Spring 24 L. Joskowiz

4 Humn oe: onstrution Ie: uil the tree ottom-up, strting with the oe-wors s les o the tree n reting intermeite noes merging the two lestrequent ojets, up to the root. o eiientl in the two lest-requent ojets, use minimum priorit queue. he result o the merger o two ojets is new ojet whose requen is the sum o the requenies o the merge ojets. Dt Strutures, Spring 24 L. Joskowiz Emple: Humn oe onstrution Strt: Step : Step 2: 5 e 9 2 : : e e 9 5 : 3 2 Dt Strutures, Spring 24 L. Joskowiz Emple: Humn oe onstrution 2 Emple: Humn oe onstrution 3 Step 3: : e Step 4: 45 : e 9 5 Dt Strutures, Spring 24 L. Joskowiz Dt Strutures, Spring 24 L. Joskowiz Emple: Humn oe onstrution 3 Step 5: : e 9 5 Dt Strutures, Spring 24 L. Joskowiz Humn oe onstrution lgorithm Humn n Q or i to n o llote new noe z letz] Etrt-MinQ rightz] Etrt-MinQ z + InsertQ, z return Etrt-MinQ ompleit: On lg n Dt Strutures, Spring 24 L. Joskowiz

5 Dt Strutures, Spring 24 L. Joskowiz Optimlit proo Lemm : Let e oe lphet n, two oewors in with the lowest requenies. hen there eists n optiml prei oe tree in whih n re siling leves. Proo: tke tree o n ritrr optiml prei oe where n re not silings n moi it so tht n eome silings o mimum epth n the tree remins optiml. his n e one with two trnsormtions. Dt Strutures, Spring 24 L. Joskowiz Optimlit proo 2 irst trnsormtion seon trnsormtion Dt Strutures, Spring 24 L. Joskowiz Optimlit proo 3 Let n two oe-wors tht re siling leves t mimum epth in. Assume tht n. Sine n re the two lowest requenies, n. First trnsormtion: ehnge the positions o n in to proue new tree. Seon trnsormtion: ehnge the positions o n in to proue new tree. Show tht the ost o the trees remins the sme. Dt Strutures, Spring 24 L. Joskowiz Optimlit proo 4 ] ] ] ] B B First trnsormtion: euse n Sine is optiml, B = B Dt Strutures, Spring 24 L. Joskowiz Optimlit proo 5 ] ] ] ] B B Seon trnsormtion: euse n Sine is optiml, B = B Dt Strutures, Spring 24 L. Joskowiz onlusion rom Lemm Builing up n optiml tree mergers n egin with the gree hoie o merging together the two oe-wors with the lowest requenies. his is gree hoie sine the ost o single merger is the sum o the lowest requenies, whih is the lest epensive merge.

6 Optimlit proo: lemm 2 Lemm 2: Let e n optiml prei oe tree or oe lphet. onsier n two siling oewors n in n let z e their prent in. hen, onsiering z s hrter with requen z = +, the tree = {,} represents n optiml prei oe or the oe lphet = {,} U {z}. Proo: we irst epress the ost B o tree s untion o the ost B o tree. Optimlit proo: lemm 2 2 For ll in {,}, = n thus =. Sine = = z +, we get: + = + ] z + = z z + + ] hereore, B = B + + ] B = B + ] Dt Strutures, Spring 24 L. Joskowiz Dt Strutures, Spring 24 L. Joskowiz Optimlit proo: lemm 2 3 We prove the lemm ontrition: Suppose tht oes not represent n optiml prei oe or. hen there eist tree whose ost is etter thn tht o : B < B. B Lemm, hs two silings, n. Let e the tree with the ommon prent o n reple le z with requen z = +. hen: B = B + ] < B + ] = B ieling ontrition to eing n optiml oe or. Dt Strutures, Spring 24 L. Joskowiz Optimlit proo: Humn lgorithm heorem: Humn s lgorithm proues n optiml prei oe. Proo: B inution on the size o the oe lphet, using Lemms n 2. For = 2 it is trivil, sine the tree hs two leves, ssigne to n, oth o length. Dt Strutures, Spring 24 L. Joskowiz he inution step Suppose the Humn lgorithm genertes n optiml oe or oe o size n, let us prove this or with = n +. Let e the tree generte or the Humn lgorithm, Let n e two noes with miniml requenies tht the Humn lgorithm piks irst. Suppose in ontrition tht S is tree or =n+, whih is stritl etter thn : BS< B. B Lemm, we n ssume tht S hs, s silings. Deine the noe z to e their prent, S to e the su-tree o S without n, to e the su-tree o without,. is the Humn oe generte or {,} U {z} with z = +. S esries prei oe or {,} U {z } with z = +. Dt Strutures, Spring 24 L. Joskowiz ompre now S n : = z he inution step 2 S S = BS = BS S + S ] + z S z Sine S = S = S z +, we get: BS = BS n similrl, B = B Dt Strutures, Spring 24 L. Joskowiz z

7 he inution step 3 But now i BS < B we hve tht BS < B. Sine S = = n, this ontrits the inution ssumption tht, the Humn oe or {.} U {z} is optiml! Etensions n pplitions -r oes: we merge the ojets with the lest requen t eh step, reting new ojet. whose requen is the sum o the requenies Mn more oing tehniques! Dt Strutures, Spring 24 L. Joskowiz Dt Strutures, Spring 24 L. Joskowiz

Lecture 6: Coding theory

Lecture 6: Coding theory Leture 6: Coing theory Biology 429 Crl Bergstrom Ferury 4, 2008 Soures: This leture loosely follows Cover n Thoms Chpter 5 n Yeung Chpter 3. As usul, some of the text n equtions re tken iretly from those

More information

Boolean Algebra cont. The digital abstraction

Boolean Algebra cont. The digital abstraction Boolen Alger ont The igitl strtion Theorem: Asorption Lw For every pir o elements B. + =. ( + ) = Proo: () Ientity Distriutivity Commuttivity Theorem: For ny B + = Ientity () ulity. Theorem: Assoitive

More information

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

Connectivity in Graphs. CS311H: Discrete Mathematics. Graph Theory II. Example. Paths. Connectedness. Example

Connectivity in Graphs. CS311H: Discrete Mathematics. Graph Theory II. Example. Paths. Connectedness. Example Connetiit in Grphs CSH: Disrete Mthemtis Grph Theor II Instrtor: Işıl Dillig Tpil qestion: Is it possile to get from some noe to nother noe? Emple: Trin netork if there is pth from to, possile to tke trin

More information

Section 2.3. Matrix Inverses

Section 2.3. Matrix Inverses Mtri lger Mtri nverses Setion.. Mtri nverses hree si opertions on mtries, ition, multiplition, n sutrtion, re nlogues for mtries of the sme opertions for numers. n this setion we introue the mtri nlogue

More information

Counting Paths Between Vertices. Isomorphism of Graphs. Isomorphism of Graphs. Isomorphism of Graphs. Isomorphism of Graphs. Isomorphism of Graphs

Counting Paths Between Vertices. Isomorphism of Graphs. Isomorphism of Graphs. Isomorphism of Graphs. Isomorphism of Graphs. Isomorphism of Graphs Isomorphism of Grphs Definition The simple grphs G 1 = (V 1, E 1 ) n G = (V, E ) re isomorphi if there is ijetion (n oneto-one n onto funtion) f from V 1 to V with the property tht n re jent in G 1 if

More information

22: Union Find. CS 473u - Algorithms - Spring April 14, We want to maintain a collection of sets, under the operations of:

22: Union Find. CS 473u - Algorithms - Spring April 14, We want to maintain a collection of sets, under the operations of: 22: Union Fin CS 473u - Algorithms - Spring 2005 April 14, 2005 1 Union-Fin We wnt to mintin olletion of sets, uner the opertions of: 1. MkeSet(x) - rete set tht ontins the single element x. 2. Fin(x)

More information

CS 491G Combinatorial Optimization Lecture Notes

CS 491G Combinatorial Optimization Lecture Notes CS 491G Comintoril Optimiztion Leture Notes Dvi Owen July 30, August 1 1 Mthings Figure 1: two possile mthings in simple grph. Definition 1 Given grph G = V, E, mthing is olletion of eges M suh tht e i,

More information

Global alignment. Genome Rearrangements Finding preserved genes. Lecture 18

Global alignment. Genome Rearrangements Finding preserved genes. Lecture 18 Computt onl Biology Leture 18 Genome Rerrngements Finding preserved genes We hve seen before how to rerrnge genome to obtin nother one bsed on: Reversls Knowledge of preserved bloks (or genes) Now we re

More information

Lecture 11 Binary Decision Diagrams (BDDs)

Lecture 11 Binary Decision Diagrams (BDDs) C 474A/57A Computer-Aie Logi Design Leture Binry Deision Digrms (BDDs) C 474/575 Susn Lyseky o 3 Boolen Logi untions Representtions untion n e represente in ierent wys ruth tle, eqution, K-mp, iruit, et

More information

CS311 Computational Structures Regular Languages and Regular Grammars. Lecture 6

CS311 Computational Structures Regular Languages and Regular Grammars. Lecture 6 CS311 Computtionl Strutures Regulr Lnguges nd Regulr Grmmrs Leture 6 1 Wht we know so fr: RLs re losed under produt, union nd * Every RL n e written s RE, nd every RE represents RL Every RL n e reognized

More information

2.4 Theoretical Foundations

2.4 Theoretical Foundations 2 Progrmming Lnguge Syntx 2.4 Theoretil Fountions As note in the min text, snners n prsers re se on the finite utomt n pushown utomt tht form the ottom two levels of the Chomsky lnguge hierrhy. At eh level

More information

50 AMC Lectures Problem Book 2 (36) Substitution Method

50 AMC Lectures Problem Book 2 (36) Substitution Method 0 AMC Letures Prolem Book Sustitution Metho PROBLEMS Prolem : Solve for rel : 9 + 99 + 9 = Prolem : Solve for rel : 0 9 8 8 Prolem : Show tht if 8 Prolem : Show tht + + if rel numers,, n stisf + + = Prolem

More information

Computational Biology Lecture 18: Genome rearrangements, finding maximal matches Saad Mneimneh

Computational Biology Lecture 18: Genome rearrangements, finding maximal matches Saad Mneimneh Computtionl Biology Leture 8: Genome rerrngements, finding miml mthes Sd Mneimneh We hve seen how to rerrnge genome to otin nother one sed on reversls nd the knowledge of the preserved loks or genes. Now

More information

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

The Knapsack Problem. COSC 3101A - Design and Analysis of Algorithms 9. Fractional Knapsack Problem. Fractional Knapsack Problem 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

More information

Factorising FACTORISING.

Factorising FACTORISING. Ftorising FACTORISING www.mthletis.om.u Ftorising FACTORISING Ftorising is the opposite of expning. It is the proess of putting expressions into rkets rther thn expning them out. In this setion you will

More information

Mid-Term Examination - Spring 2014 Mathematical Programming with Applications to Economics Total Score: 45; Time: 3 hours

Mid-Term Examination - Spring 2014 Mathematical Programming with Applications to Economics Total Score: 45; Time: 3 hours Mi-Term Exmintion - Spring 0 Mthemtil Progrmming with Applitions to Eonomis Totl Sore: 5; Time: hours. Let G = (N, E) e irete grph. Define the inegree of vertex i N s the numer of eges tht re oming into

More information

1 PYTHAGORAS THEOREM 1. Given a right angled triangle, the square of the hypotenuse is equal to the sum of the squares of the other two sides.

1 PYTHAGORAS THEOREM 1. Given a right angled triangle, the square of the hypotenuse is equal to the sum of the squares of the other two sides. 1 PYTHAGORAS THEOREM 1 1 Pythgors Theorem In this setion we will present geometri proof of the fmous theorem of Pythgors. Given right ngled tringle, the squre of the hypotenuse is equl to the sum of the

More information

Chapter Gauss Quadrature Rule of Integration

Chapter Gauss Quadrature Rule of Integration Chpter 7. Guss Qudrture Rule o Integrtion Ater reding this hpter, you should e le to:. derive the Guss qudrture method or integrtion nd e le to use it to solve prolems, nd. use Guss qudrture method to

More information

Solutions for HW9. Bipartite: put the red vertices in V 1 and the black in V 2. Not bipartite!

Solutions for HW9. Bipartite: put the red vertices in V 1 and the black in V 2. Not bipartite! Solutions for HW9 Exerise 28. () Drw C 6, W 6 K 6, n K 5,3. C 6 : W 6 : K 6 : K 5,3 : () Whih of the following re iprtite? Justify your nswer. Biprtite: put the re verties in V 1 n the lk in V 2. Biprtite:

More information

Surds and Indices. Surds and Indices. Curriculum Ready ACMNA: 233,

Surds and Indices. Surds and Indices. Curriculum Ready ACMNA: 233, Surs n Inies Surs n Inies Curriulum Rey ACMNA:, 6 www.mthletis.om Surs SURDS & & Inies INDICES Inies n surs re very losely relte. A numer uner (squre root sign) is lle sur if the squre root n t e simplifie.

More information

A Lower Bound for the Length of a Partial Transversal in a Latin Square, Revised Version

A Lower Bound for the Length of a Partial Transversal in a Latin Square, Revised Version A Lower Bound for the Length of Prtil Trnsversl in Ltin Squre, Revised Version Pooy Htmi nd Peter W. Shor Deprtment of Mthemtil Sienes, Shrif University of Tehnology, P.O.Bo 11365-9415, Tehrn, Irn Deprtment

More information

NON-DETERMINISTIC FSA

NON-DETERMINISTIC FSA Tw o types of non-determinism: NON-DETERMINISTIC FS () Multiple strt-sttes; strt-sttes S Q. The lnguge L(M) ={x:x tkes M from some strt-stte to some finl-stte nd ll of x is proessed}. The string x = is

More information

Outline Data Structures and Algorithms. Data compression. Data compression. Lossy vs. Lossless. Data Compression

Outline Data Structures and Algorithms. Data compression. Data compression. Lossy vs. Lossless. Data Compression 5-2 Dt Strutures n Algorithms Dt Compression n Huffmn s Algorithm th Fe 2003 Rjshekr Rey Outline Dt ompression Lossy n lossless Exmples Forml view Coes Definition Fixe length vs. vrile length Huffmn s

More information

CSE 332. Sorting. Data Abstractions. CSE 332: Data Abstractions. QuickSort Cutoff 1. Where We Are 2. Bounding The MAXIMUM Problem 4

CSE 332. Sorting. Data Abstractions. CSE 332: Data Abstractions. QuickSort Cutoff 1. Where We Are 2. Bounding The MAXIMUM Problem 4 Am Blnk Leture 13 Winter 2016 CSE 332 CSE 332: Dt Astrtions Sorting Dt Astrtions QuikSort Cutoff 1 Where We Are 2 For smll n, the reursion is wste. The onstnts on quik/merge sort re higher thn the ones

More information

Chapter 3 Single Random Variables and Probability Distributions (Part 2)

Chapter 3 Single Random Variables and Probability Distributions (Part 2) Chpter 3 Single Rndom Vriles nd Proilit Distriutions (Prt ) Contents Wht is Rndom Vrile? Proilit Distriution Functions Cumultive Distriution Function Proilit Densit Function Common Rndom Vriles nd their

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

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

Data Compression Techniques (Spring 2012) Model Solutions for Exercise 4

Data Compression Techniques (Spring 2012) Model Solutions for Exercise 4 58487 Dt Compressio Tehiques (Sprig 0) Moel Solutios for Exerise 4 If you hve y fee or orretios, plese ott jro.lo t s.helsii.fi.. Prolem: Let T = Σ = {,,, }. Eoe T usig ptive Huffm oig. Solutio: R 4 U

More information

CS344: Introduction to Artificial Intelligence

CS344: Introduction to Artificial Intelligence CS344: Introduction to Artiicil Intelligence Lecture: 22-23 Herbrnd s Theorem roving stisibilit o logic ormule using semntic trees rom Smbolic logic nd mechnicl theorem proving B Runk ilni Under the guidnce

More information

Grammar. Languages. Content 5/10/16. Automata and Languages. Regular Languages. Regular Languages

Grammar. Languages. Content 5/10/16. Automata and Languages. Regular Languages. Regular Languages 5//6 Grmmr Automt nd Lnguges Regulr Grmmr Context-free Grmmr Context-sensitive Grmmr Prof. Mohmed Hmd Softwre Engineering L. The University of Aizu Jpn Regulr Lnguges Context Free Lnguges Context Sensitive

More information

SIMPLE NONLINEAR GRAPHS

SIMPLE NONLINEAR GRAPHS S i m p l e N o n l i n e r G r p h s SIMPLE NONLINEAR GRAPHS www.mthletis.om.u Simple SIMPLE Nonliner NONLINEAR Grphs GRAPHS Liner equtions hve the form = m+ where the power of (n ) is lws. The re lle

More information

CS241 Week 6 Tutorial Solutions

CS241 Week 6 Tutorial Solutions 241 Week 6 Tutoril olutions Lnguges: nning & ontext-free Grmmrs Winter 2018 1 nning Exerises 1. 0x0x0xd HEXINT 0x0 I x0xd 2. 0xend--- HEXINT 0xe I nd ER -- MINU - 3. 1234-120x INT 1234 INT -120 I x 4.

More information

Arrow s Impossibility Theorem

Arrow s Impossibility Theorem Rep Voting Prdoxes Properties Arrow s Theorem Arrow s Impossiility Theorem Leture 12 Arrow s Impossiility Theorem Leture 12, Slide 1 Rep Voting Prdoxes Properties Arrow s Theorem Leture Overview 1 Rep

More information

6.5 Improper integrals

6.5 Improper integrals Eerpt from "Clulus" 3 AoPS In. www.rtofprolemsolving.om 6.5. IMPROPER INTEGRALS 6.5 Improper integrls As we ve seen, we use the definite integrl R f to ompute the re of the region under the grph of y =

More information

Technische Universität München Winter term 2009/10 I7 Prof. J. Esparza / J. Křetínský / M. Luttenberger 11. Februar Solution

Technische Universität München Winter term 2009/10 I7 Prof. J. Esparza / J. Křetínský / M. Luttenberger 11. Februar Solution Tehnishe Universität Münhen Winter term 29/ I7 Prof. J. Esprz / J. Křetínský / M. Luttenerger. Ferur 2 Solution Automt nd Forml Lnguges Homework 2 Due 5..29. Exerise 2. Let A e the following finite utomton:

More information

PAIR OF LINEAR EQUATIONS IN TWO VARIABLES

PAIR OF LINEAR EQUATIONS IN TWO VARIABLES PAIR OF LINEAR EQUATIONS IN TWO VARIABLES. Two liner equtions in the sme two vriles re lled pir of liner equtions in two vriles. The most generl form of pir of liner equtions is x + y + 0 x + y + 0 where,,,,,,

More information

CISC 320 Introduction to Algorithms Spring 2014

CISC 320 Introduction to Algorithms Spring 2014 CISC 20 Introdution to Algorithms Spring 2014 Leture 9 Red-Blk Trees Courtes of Prof. Lio Li 1 Binr Serh Trees (BST) ke[x]: ke stored t x. left[x]: pointer to left hild of x. right[x]: pointer to right

More information

= state, a = reading and q j

= state, a = reading and q j 4 Finite Automt CHAPTER 2 Finite Automt (FA) (i) Derterministi Finite Automt (DFA) A DFA, M Q, q,, F, Where, Q = set of sttes (finite) q Q = the strt/initil stte = input lphet (finite) (use only those

More information

A Primer on Continuous-time Economic Dynamics

A Primer on Continuous-time Economic Dynamics Eonomis 205A Fll 2008 K Kletzer A Primer on Continuous-time Eonomi Dnmis A Liner Differentil Eqution Sstems (i) Simplest se We egin with the simple liner first-orer ifferentil eqution The generl solution

More information

MAT 403 NOTES 4. f + f =

MAT 403 NOTES 4. f + f = MAT 403 NOTES 4 1. Fundmentl Theorem o Clulus We will proo more generl version o the FTC thn the textook. But just like the textook, we strt with the ollowing proposition. Let R[, ] e the set o Riemnn

More information

Logarithms LOGARITHMS.

Logarithms LOGARITHMS. Logrithms LOGARITHMS www.mthletis.om.u Logrithms LOGARITHMS Logrithms re nother method to lulte nd work with eponents. Answer these questions, efore working through this unit. I used to think: In the

More information

for all x in [a,b], then the area of the region bounded by the graphs of f and g and the vertical lines x = a and x = b is b [ ( ) ( )] A= f x g x dx

for all x in [a,b], then the area of the region bounded by the graphs of f and g and the vertical lines x = a and x = b is b [ ( ) ( )] A= f x g x dx Applitions of Integrtion Are of Region Between Two Curves Ojetive: Fin the re of region etween two urves using integrtion. Fin the re of region etween interseting urves using integrtion. Desrie integrtion

More information

Something found at a salad bar

Something found at a salad bar Nme PP Something found t sld r 4.7 Notes RIGHT TRINGLE hs extly one right ngle. To solve right tringle, you n use things like SOH-H-TO nd the Pythgoren Theorem. n OLIQUE TRINGLE hs no right ngles. To solve

More information

The University of Nottingham SCHOOL OF COMPUTER SCIENCE A LEVEL 2 MODULE, SPRING SEMESTER MACHINES AND THEIR LANGUAGES ANSWERS

The University of Nottingham SCHOOL OF COMPUTER SCIENCE A LEVEL 2 MODULE, SPRING SEMESTER MACHINES AND THEIR LANGUAGES ANSWERS The University of ottinghm SCHOOL OF COMPUTR SCIC A LVL 2 MODUL, SPRIG SMSTR 2015 2016 MACHIS AD THIR LAGUAGS ASWRS Time llowed TWO hours Cndidtes my omplete the front over of their nswer ook nd sign their

More information

are coplanar. ˆ ˆ ˆ and iˆ

are coplanar. ˆ ˆ ˆ and iˆ SML QUSTION Clss XII Mthemtis Time llowed: hrs Mimum Mrks: Generl Instrutions: i ll questions re ompulsor ii The question pper onsists of 6 questions divided into three Setions, B nd C iii Question No

More information

CS 2204 DIGITAL LOGIC & STATE MACHINE DESIGN SPRING 2014

CS 2204 DIGITAL LOGIC & STATE MACHINE DESIGN SPRING 2014 S 224 DIGITAL LOGI & STATE MAHINE DESIGN SPRING 214 DUE : Mrh 27, 214 HOMEWORK III READ : Relte portions of hpters VII n VIII ASSIGNMENT : There re three questions. Solve ll homework n exm prolems s shown

More information

CIT 596 Theory of Computation 1. Graphs and Digraphs

CIT 596 Theory of Computation 1. Graphs and Digraphs CIT 596 Theory of Computtion 1 A grph G = (V (G), E(G)) onsists of two finite sets: V (G), the vertex set of the grph, often enote y just V, whih is nonempty set of elements lle verties, n E(G), the ege

More information

Exercise sheet 6: Solutions

Exercise sheet 6: Solutions Eerise sheet 6: Solutions Cvet emptor: These re merel etended hints, rther thn omplete solutions. 1. If grph G hs hromti numer k > 1, prove tht its verte set n e prtitioned into two nonempt sets V 1 nd

More information

SECTION A STUDENT MATERIAL. Part 1. What and Why.?

SECTION A STUDENT MATERIAL. Part 1. What and Why.? SECTION A STUDENT MATERIAL Prt Wht nd Wh.? Student Mteril Prt Prolem n > 0 n > 0 Is the onverse true? Prolem If n is even then n is even. If n is even then n is even. Wht nd Wh? Eploring Pure Mths Are

More information

Section 1.3 Triangles

Section 1.3 Triangles Se 1.3 Tringles 21 Setion 1.3 Tringles LELING TRINGLE The line segments tht form tringle re lled the sides of the tringle. Eh pir of sides forms n ngle, lled n interior ngle, nd eh tringle hs three interior

More information

Prefix-Free Regular-Expression Matching

Prefix-Free Regular-Expression Matching Prefix-Free Regulr-Expression Mthing Yo-Su Hn, Yjun Wng nd Derik Wood Deprtment of Computer Siene HKUST Prefix-Free Regulr-Expression Mthing p.1/15 Pttern Mthing Given pttern P nd text T, find ll sustrings

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

Boolean Algebra. Boolean Algebra

Boolean Algebra. Boolean Algebra Boolen Alger Boolen Alger A Boolen lger is set B of vlues together with: - two inry opertions, commonly denoted y + nd, - unry opertion, usully denoted y ˉ or ~ or, - two elements usully clled zero nd

More information

Lecture 4: Graph Theory and the Four-Color Theorem

Lecture 4: Graph Theory and the Four-Color Theorem CCS Disrete II Professor: Pri Brtlett Leture 4: Grph Theory n the Four-Color Theorem Week 4 UCSB 2015 Through the rest of this lss, we re going to refer frequently to things lle grphs! If you hen t seen

More information

Ch. 2.3 Counting Sample Points. Cardinality of a Set

Ch. 2.3 Counting Sample Points. Cardinality of a Set Ch..3 Counting Smple Points CH 8 Crdinlity of Set Let S e set. If there re extly n distint elements in S, where n is nonnegtive integer, we sy S is finite set nd n is the rdinlity of S. The rdinlity of

More information

I 3 2 = I I 4 = 2A

I 3 2 = I I 4 = 2A ECE 210 Eletril Ciruit Anlysis University of llinois t Chigo 2.13 We re ske to use KCL to fin urrents 1 4. The key point in pplying KCL in this prolem is to strt with noe where only one of the urrents

More information

CARLETON UNIVERSITY. 1.0 Problems and Most Solutions, Sect B, 2005

CARLETON UNIVERSITY. 1.0 Problems and Most Solutions, Sect B, 2005 RLETON UNIVERSIT eprtment of Eletronis ELE 2607 Swithing iruits erury 28, 05; 0 pm.0 Prolems n Most Solutions, Set, 2005 Jn. 2, #8 n #0; Simplify, Prove Prolem. #8 Simplify + + + Reue to four letters (literls).

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

Compression of Palindromes and Regularity.

Compression of Palindromes and Regularity. Compression of Plinromes n Regulrity. Kyoko Shikishim-Tsuji Center for Lierl Arts Eution n Reserh Tenri University 1 Introution In [1], property of likstrem t t view of tse is isusse n it is shown tht

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

Finite State Automata and Determinisation

Finite State Automata and Determinisation Finite Stte Automt nd Deterministion Tim Dworn Jnury, 2016 Lnguges fs nf re df Deterministion 2 Outline 1 Lnguges 2 Finite Stte Automt (fs) 3 Non-deterministi Finite Stte Automt (nf) 4 Regulr Expressions

More information

Necessary and sucient conditions for some two. Abstract. Further we show that the necessary conditions for the existence of an OD(44 s 1 s 2 )

Necessary and sucient conditions for some two. Abstract. Further we show that the necessary conditions for the existence of an OD(44 s 1 s 2 ) Neessry n suient onitions for some two vrile orthogonl esigns in orer 44 C. Koukouvinos, M. Mitrouli y, n Jennifer Seerry z Deite to Professor Anne Penfol Street Astrt We give new lgorithm whih llows us

More information

XML and Databases. Exam Preperation Discuss Answers to last year s exam. Sebastian Maneth NICTA and UNSW

XML and Databases. Exam Preperation Discuss Answers to last year s exam. Sebastian Maneth NICTA and UNSW XML n Dtses Exm Prepertion Disuss Answers to lst yer s exm Sestin Mneth NICTA n UNSW CSE@UNSW -- Semester 1, 2008 (1) For eh of the following, explin why it is not well-forme XML (is WFC or the XML grmmr

More information

Subsequence Automata with Default Transitions

Subsequence Automata with Default Transitions Susequene Automt with Defult Trnsitions Philip Bille, Inge Li Gørtz, n Freerik Rye Skjoljensen Tehnil University of Denmrk {phi,inge,fskj}@tu.k Astrt. Let S e string of length n with hrters from n lphet

More information

8.3 THE HYPERBOLA OBJECTIVES

8.3 THE HYPERBOLA OBJECTIVES 8.3 THE HYPERBOLA OBJECTIVES 1. Define Hperol. Find the Stndrd Form of the Eqution of Hperol 3. Find the Trnsverse Ais 4. Find the Eentriit of Hperol 5. Find the Asmptotes of Hperol 6. Grph Hperol HPERBOLAS

More information

CS 573 Automata Theory and Formal Languages

CS 573 Automata Theory and Formal Languages Non-determinism Automt Theory nd Forml Lnguges Professor Leslie Lnder Leture # 3 Septemer 6, 2 To hieve our gol, we need the onept of Non-deterministi Finite Automton with -moves (NFA) An NFA is tuple

More information

Algorithm Design and Analysis

Algorithm Design and Analysis Algorithm Design nd Anlysis LECTURE 8 Mx. lteness ont d Optiml Ching Adm Smith 9/12/2008 A. Smith; sed on slides y E. Demine, C. Leiserson, S. Rskhodnikov, K. Wyne Sheduling to Minimizing Lteness Minimizing

More information

Logic, Set Theory and Computability [M. Coppenbarger]

Logic, Set Theory and Computability [M. Coppenbarger] 14 Orer (Hnout) Definition 7-11: A reltion is qusi-orering (or preorer) if it is reflexive n trnsitive. A quisi-orering tht is symmetri is n equivlene reltion. A qusi-orering tht is nti-symmetri is n orer

More information

Coding Techniques. Manjunatha. P. Professor Dept. of ECE. June 28, J.N.N. College of Engineering, Shimoga.

Coding Techniques. Manjunatha. P. Professor Dept. of ECE. June 28, J.N.N. College of Engineering, Shimoga. Coing Tehniques Mnjunth. P mnjup.jnne@gmil.om Professor Dept. of ECE J.N.N. College of Engineering, Shimog June 8, 3 Overview Convolutionl Enoing Mnjunth. P (JNNCE) Coing Tehniques June 8, 3 / 8 Overview

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

Arrow s Impossibility Theorem

Arrow s Impossibility Theorem Rep Fun Gme Properties Arrow s Theorem Arrow s Impossiility Theorem Leture 12 Arrow s Impossiility Theorem Leture 12, Slide 1 Rep Fun Gme Properties Arrow s Theorem Leture Overview 1 Rep 2 Fun Gme 3 Properties

More information

Lecture 8: Abstract Algebra

Lecture 8: Abstract Algebra Mth 94 Professor: Pri Brtlett Leture 8: Astrt Alger Week 8 UCSB 2015 This is the eighth week of the Mthemtis Sujet Test GRE prep ourse; here, we run very rough-n-tumle review of strt lger! As lwys, this

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

Gauss Quadrature Rule of Integration

Gauss Quadrature Rule of Integration Guss Qudrture Rule o Integrtion Computer Engineering Mjors Authors: Autr Kw, Chrlie Brker http://numerilmethods.eng.us.edu Trnsorming Numeril Methods Edution or STEM Undergrdutes /0/00 http://numerilmethods.eng.us.edu

More information

Graph States EPIT Mehdi Mhalla (Calgary, Canada) Simon Perdrix (Grenoble, France)

Graph States EPIT Mehdi Mhalla (Calgary, Canada) Simon Perdrix (Grenoble, France) Grph Sttes EPIT 2005 Mehdi Mhll (Clgry, Cnd) Simon Perdrix (Grenole, Frne) simon.perdrix@img.fr Grph Stte: Introdution A grph-sed representtion of the entnglement of some (lrge) quntum stte. Verties: quits

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

Project 6: Minigoals Towards Simplifying and Rewriting Expressions

Project 6: Minigoals Towards Simplifying and Rewriting Expressions MAT 51 Wldis Projet 6: Minigols Towrds Simplifying nd Rewriting Expressions The distriutive property nd like terms You hve proly lerned in previous lsses out dding like terms ut one prolem with the wy

More information

AVL Trees. D Oisín Kidney. August 2, 2018

AVL Trees. D Oisín Kidney. August 2, 2018 AVL Trees D Oisín Kidne August 2, 2018 Astrt This is verified implementtion of AVL trees in Agd, tking ides primril from Conor MBride s pper How to Keep Your Neighours in Order [2] nd the Agd stndrd lirr

More information

Solids of Revolution

Solids of Revolution Solis of Revolution Solis of revolution re rete tking n re n revolving it roun n is of rottion. There re two methos to etermine the volume of the soli of revolution: the isk metho n the shell metho. Disk

More information

Part I: Study the theorem statement.

Part I: Study the theorem statement. Nme 1 Nme 2 Nme 3 A STUDY OF PYTHAGORAS THEOREM Instrutions: Together in groups of 2 or 3, fill out the following worksheet. You my lift nswers from the reding, or nswer on your own. Turn in one pket for

More information

Slope Lengths for 2-Bridge Parent Manifolds. Martin D. Bobb

Slope Lengths for 2-Bridge Parent Manifolds. Martin D. Bobb Cliorni Stte University, Sn Bernrino Reserh Experiene or Unergrutes Knot Theory Otoer 28, 2013 Hyperoli Knot Complements Hyperoli Knots Deinition A knot or link K is hyperoli i hyperoli metri n e ple on

More information

A Rewrite Approach for Pattern Containment

A Rewrite Approach for Pattern Containment A Rewrite Approh or Pttern Continment Brr Kory rr.kory@univ-orlens.r LIFO - Université Orléns, Frne Astrt. In this pper we introue n pproh tht llows to hnle the ontinment prolem or the rgment XP(/,//,[

More information

Discrete Structures Lecture 11

Discrete Structures Lecture 11 Introdution Good morning. In this setion we study funtions. A funtion is mpping from one set to nother set or, perhps, from one set to itself. We study the properties of funtions. A mpping my not e funtion.

More information

Solutions to Problem Set #1

Solutions to Problem Set #1 CSE 233 Spring, 2016 Solutions to Prolem Set #1 1. The movie tse onsists of the following two reltions movie: title, iretor, tor sheule: theter, title The first reltion provies titles, iretors, n tors

More information

TIME AND STATE IN DISTRIBUTED SYSTEMS

TIME AND STATE IN DISTRIBUTED SYSTEMS Distriuted Systems Fö 5-1 Distriuted Systems Fö 5-2 TIME ND STTE IN DISTRIUTED SYSTEMS 1. Time in Distriuted Systems Time in Distriuted Systems euse eh mhine in distriuted system hs its own lok there is

More information

CS261: A Second Course in Algorithms Lecture #5: Minimum-Cost Bipartite Matching

CS261: A Second Course in Algorithms Lecture #5: Minimum-Cost Bipartite Matching CS261: A Seon Course in Algorithms Leture #5: Minimum-Cost Biprtite Mthing Tim Roughgren Jnury 19, 2016 1 Preliminries Figure 1: Exmple of iprtite grph. The eges {, } n {, } onstitute mthing. Lst leture

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

Common intervals of genomes. Mathieu Raffinot CNRS LIAFA

Common intervals of genomes. Mathieu Raffinot CNRS LIAFA Common intervls of genomes Mthieu Rffinot CNRS LIF Context: omprtive genomis. set of genomes prtilly/totlly nnotte Informtive group of genes or omins? Ex: COG tse Mny iffiulties! iology Wht re two similr

More information

Reference : Croft & Davison, Chapter 12, Blocks 1,2. A matrix ti is a rectangular array or block of numbers usually enclosed in brackets.

Reference : Croft & Davison, Chapter 12, Blocks 1,2. A matrix ti is a rectangular array or block of numbers usually enclosed in brackets. I MATRIX ALGEBRA INTRODUCTION TO MATRICES Referene : Croft & Dvison, Chpter, Blos, A mtri ti is retngulr rr or lo of numers usull enlosed in rets. A m n mtri hs m rows nd n olumns. Mtri Alger Pge If the

More information

A Differential Approach to Inference in Bayesian Networks

A Differential Approach to Inference in Bayesian Networks Dierentil pproh to Inerene in Byesin Networks esented y Ynn Shen shenyn@mi.pitt.edu Outline Introdution Oeriew o lgorithms or inerene in Byesin networks (BN) oposed new pproh How to represent BN s multi-rite

More information

Numbers and indices. 1.1 Fractions. GCSE C Example 1. Handy hint. Key point

Numbers and indices. 1.1 Fractions. GCSE C Example 1. Handy hint. Key point GCSE C Emple 7 Work out 9 Give your nswer in its simplest form Numers n inies Reiprote mens invert or turn upsie own The reiprol of is 9 9 Mke sure you only invert the frtion you re iviing y 7 You multiply

More information

Chapter 4 State-Space Planning

Chapter 4 State-Space Planning Leture slides for Automted Plnning: Theory nd Prtie Chpter 4 Stte-Spe Plnning Dn S. Nu CMSC 722, AI Plnning University of Mrylnd, Spring 2008 1 Motivtion Nerly ll plnning proedures re serh proedures Different

More information

Spacetime and the Quantum World Questions Fall 2010

Spacetime and the Quantum World Questions Fall 2010 Spetime nd the Quntum World Questions Fll 2010 1. Cliker Questions from Clss: (1) In toss of two die, wht is the proility tht the sum of the outomes is 6? () P (x 1 + x 2 = 6) = 1 36 - out 3% () P (x 1

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

Algorithms & Data Structures Homework 8 HS 18 Exercise Class (Room & TA): Submitted by: Peer Feedback by: Points:

Algorithms & Data Structures Homework 8 HS 18 Exercise Class (Room & TA): Submitted by: Peer Feedback by: Points: Eidgenössishe Tehnishe Hohshule Zürih Eole polytehnique fédérle de Zurih Politenio federle di Zurigo Federl Institute of Tehnology t Zurih Deprtement of Computer Siene. Novemer 0 Mrkus Püshel, Dvid Steurer

More information

Lecture 2: Cayley Graphs

Lecture 2: Cayley Graphs Mth 137B Professor: Pri Brtlett Leture 2: Cyley Grphs Week 3 UCSB 2014 (Relevnt soure mteril: Setion VIII.1 of Bollos s Moern Grph Theory; 3.7 of Gosil n Royle s Algeri Grph Theory; vrious ppers I ve re

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

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