n Bottom-up (LR) parsing n Characteristic Finite State Machine (CFSM) n SLR(1) parsing table n Conflicts in SLR(1) n LR parsing variants
|
|
- Madeleine Perkins
- 5 years ago
- Views:
Transcription
1 Aoucemets Gradig HW1 Should be doe by the ed of today. Grades are set to release toight You have 1 week to issue re-grade request Raibow grades comig up over the weeked Last Class Bottom-up (LR) parsig Characteristic Fiite State Machie (CFSM) SLR(1) parsig table Coflicts i SLR(1) LR parsig variats Dowload SWI Prolog! HW3 is posted, due o Sept 28 th Logic Programmig Cocepts Laguage costructs: facts, queries, rules Idividual assigmet Fall 18 CSCI 4430, A Milaova 1 Fall 18 CSCI 4430, A Milaova 2 Today s Lecture Outlie Laguage costructs: facts, rules, queries Search tree, uificatio, backtrackig, backward chaiig Lists Arithmetic Logic Programmig ad Prolog Read: Scott, Chapter 12 Fall 18 CSCI 4430, A Milaova 3 4 Prolog Dowload ad istall SWI Prolog o laptop! Write your Prolog program ad save i.pl file, e.g., family.pl Ru swipl (Prolog iterpreter) o commad lie Load your file:? [family]. Issue query at prompt:? female(c). J.R.Fisher s Prolog Tutorial: Logic Programmig Logic programmig Logic programmig is declarative programmig Logic program states what (logic), ot how (cotrol) Programmer declares axioms I, facts ad rules Programmer states a theorem, or a goal (the what) I, a query Laguage implemetatio determies how to use the axioms to prove the goal Fall 18 CSCI 4430, A Milaova 5 Fall 18 CSCI 4430, A Milaova 6 1
2 Logic Programmig Logic programmig style is characterized by Database of facts ad rules that represet logical relatios. Computatio is modeled as search (queries) over this database Maipulatio of lists ad use of recursio, i which it is very similar to the fuctioal programmig style Logic Programmig Cocepts A Hor Clause is: H B 1,B 2,,B Atecedets (B s): cojuctio of zero or more terms i predicate calculus; this is the body of the hor clause Cosequet (H): a term i predicate calculus Resolutio priciple: if two Hor clauses A B 1,B 2,B 3,, B m C D 1,D 2,D 3,, D are such that A matches D 1, the we ca replace D 1 with B 1,B 2,B 3,, B m C B 1,B 2,B 3,, B m,d 2,D 3,, D Fall 18 CSCI 4430, A Milaova 7 Fall 18 CSCI 4430, A Milaova 8 Hor Clauses i I, a Hor clause is writte h :- b 1,...,b. Hor Clause is called clause Cosequet is called goal or head Atecedets are called subgoals or tail Hor Clause with o tail is a fact E.g., raiy(seattle). Depeds o o other coditios Hor Clause with a tail is a rule sowy(x) :- raiy(x),cold(x). Fall 18 CSCI 4430, A Milaova 9 Hor Clauses i Clause is composed of terms Costats Number, e.g., 123, etc. Atoms e.g., seattle, rochester, raiy, foo I, atoms begi with a lower-case letter! Variables X, Foo, My_var, Seattle, Rochester, etc. I, variables must begi with upper-case letter! Structures cosists of a atom, called a fuctor ad a list of argumets raiy(seattle), sowy(x) 10 A Prolog Program raiy(seattle). raiy(rochester). sowy(x) :- raiy(x),cold(x).?- [sowy].?- raiy(c).?- sowy(c). Today s Lecture Outlie Laguage costructs: facts, rules, queries Search tree, uificatio, backtrackig, backward chaiig Lists Arithmetic Fall 18 CSCI 4430, A Milaova 11 Fall 18 CSCI 4430, A Milaova 12 2
3 Logical Sematics program cosists of facts ad rules raiy(seattle). raiy(rochester). sowy(x):-raiy(x),cold(x). Rules like sowy(x):- raiy(x),cold(x). correspod to logical formulas X[sowy(X) raily(x) ^ cold(x)] /* For every X, X is sowy, if X is raiy ad X is cold */ Fall 18 CSCI 4430, A Milaova 13 Logical Sematics A query such as?- raiy(c). triggers resolutio. Logical sematics does ot impose restrictio i the order of applicatio of resolutio rules C = seattle C = rochester Fall 18 CSCI 4430, A Milaova raiy(seattle). raiy(rochester). sowy(x):-raiy(x),cold(x). C = rochester C = seattle 14 Procedural Sematics?- sowy(c). raiy(seattle). raiy(rochester). sowy(x):-raiy(x),cold(x). sowy(x) :- raiy(x),cold(x). First, fid the first clause i the database whose head matches the query, i our case this is clause sowy(x) :- raiy(x),cold(x) The, fid a bidig for X to make raiy(x) true; the, check if cold(x) is true with that bidig If yes, report bidig as successful Otherwise, backtrack to the bidig of X, ubid ad cosider the ext bidig s computatio is well-defied procedurally by search tree, rule orderig, uificatio ad backtrackig Questio raiy(seattle). raiy(rochester). sowy(x):-raiy(x),cold(x). sowy(troy). What does this query yield??- sowy(c). Fall 18 CSCI 4430, A Milaova 15 Fall 18 CSCI 4430, A Milaova 16 Procedural Sematics raiy(seattle). raiy(rochester). sowy(x) :- raiy(x),cold(x). raiy(x) X = seattle OR sowy(c) _C = _X success sowy(x) AND X = rochester cold(seattle) fails; backtrack. cold(x) raiy(seattle) raiy(rochester) Prolog Cocepts: Search Tree OR levels: paret: goal (e.g., raiy(x)) childre: heads-of-clauses (raiy( )) ORDER: from left to right AND levels: paret: goal (e.g., sowy(x)) childre: subgoals (raiy(x), cold(x)) ORDER: from left to right raiy(x) OR sowy(c) sowy(x) AND raiy(seattle). raiy(rochester). sowy(x):-raiy(x),cold(x).?- sowy(c). cold(x) raiy(seattle) raiy(rochester) Fall 18 CSCI 4430, A Milaova
4 Prolog Cocepts: Uificatio Prolog Cocepts: Uificatio At OR levels Prolog performs uificatio Uifies paret (goal), with child (head-of-clause) E.g., sowy(c) = sowy(x) success, _C = _X raiy(x) = raiy(seattle) success, X = seattle parets(alice,m,f) = parets(edward,victoria,albert) fail parets(alice,m,f) = parets(alice,victoria,albert) success, M = victoria, F = albert I, = deotes uificatio, ot assigmet! A costat uifies oly with itself E.g., alice=alice, but alice=edward fails Two structures uify if ad oly if (i) they have the same fuctor, (ii) they have the same umber of argumets, ad (iii) their argumets uify recursively E.g., raiy(x) = raiy(seattle) A variable uifies with aythig. If the other thig has a value, the variable is boud to that value. If the other thig is a uboud variable, the the two variables are associated ad if either oe gets a value, both do Prolog Cocepts: Backtrackig If at some poit, a goal fails, Prolog backtracks to the last goal (i.e., last uificatio poit) where there is a utried bidig, udoes curret bidig ad tries ew bidig (a alterative OR brach), etc. raiy(x) X = seattle OR?- sowy(c). sowy(c) _C = _X sowy(x) AND raiy(seattle). raiy(rochester). sowy(x):-raiy(x),cold(x). cold(seattle) fails; backtrack. cold(x) raiy(seattle) raiy(rochester) Prolog Cocepts: Backward Chaiig Backward chaiig: starts from goal, towards facts? sowy(rochester). sowy(rochester):- raiy(rochester), raiy(rochester) sowy(rochester): sowy(rochester). Forward chaiig: starts from facts towards goal? sowy(rochester). raiy(rochester) sowy(rochester):- raiy(rochester), sowy(rochester): sowy(rochester). Fall 18 CSCI 4430, A Milaova 21 Fall 18 CSCI 4430, A Milaova 22 Exercise takes(jae, his). takes(jae, cs). takes(ajit, art). takes(ajit, cs). classmates(x,y):-takes(x,z),takes(y,z).?- classmates(jae,c). Draw search tree for query. What are the bidigs for C? Fall 18 CSCI 4430, A Milaova 23 Ruig Prolog Programs Eter database of facts ad rules ito a file. E.g., classmates.pl At the iterpreter prompt, load the file the ru queries. E.g.,?- [classmates]. true.?- takes(ajit,c). C = art ; C = cs. 24 4
5 Today s Lecture Outlie Laguage costructs: facts, rules, queries Search tree, uificatio, backtrackig, backward chaiig Lists Arithmetic Fall 18 CSCI 4430, A Milaova 25 Lists list head tail [a,b,c] a [b,c] [X,[cat],Y] X [[cat],y] [a,[b,c],d] a [[b,c],d] [X Y] X Y Fall 18 CSCI 4430, A Milaova a b a c b c [ ] [ ] [ ] d 26 Lists: Uificatio Questio [ H1 T1 ] = [ H2 T2 ] Head H1 uifies with H2, possibly recursively Tail T1 uifies with T2, possibly recursively E.g., [ a [b, c] ] = [ X Y ] X = a Y = [b, c] NOTE: I, = deotes uificatio, ot assigmet! [X,Y,Z] = [joh, likes, fish] X = joh, Y = likes, Z = fish [cat] = [X Y] X = cat, Y = [ ] [[the, Y] Z] = [[X, hare] [is,here]] X = the, Y = hare, Z = [is, here] Fall 18 CSCI 4430, A Milaova 27 Fall 18 CSCI 4430, A Milaova 28 Lists: Uificatio Lists Uificatio Sequece of comma separated terms, or [ first term rest_of_list ] [ [the Y] Z] = [ [X, hare] [is, here] ] look at the trees to see how this works! [ a, b, c ] = [ X Y ] X = a, Y = [b,c]. the Y Z X hare [ ] is here [ ] [a Z ] =? [ X Y ] X = a, Y = Z. Fall 18 CSCI 4430, A Milaova 29 Fall 18 CSCI 4430, A Milaova 30 5
6 Improper ad Proper Lists [1 2] versus [1, 2] Questio. Ca we uify these lists? [abc, Y] =? [ abc Y ] [ ] abc Y [ ] abc Y Aswer: No. There is o value bidig for Y that makes these two trees isomorphic Fall 18 CSCI 4430, A Milaova Member_of Procedure?- member(a,[a,b]). true.?- member(a,[b,c]). false.?- member(x,[a,b,c]). X = a ; 1. member(a, [A B]). X = b ; 2. member(a, [B C]) :- member (A, C). X = c.?- member(a,[b,c,x]). X = a ; false. Fall 18 CSCI 4430, A Milaova 33 Prolog Search Tree (OR levels oly) member(x,[a,b,c]) A=X=a,B=[b,c] X=a success A =X=b,B =[c] X=b success A=X,B=a,C=[b,c] member(x,[b,c]) A =X,B =b,c =[c] member(x,[c]) A =X=c,B =[ ] A =X B =c, C =[ ] X=c member(x,[ ]) success fail 1. member(a, [A B]). 2. member(a, [B C]) :- member (A, C). fail 34 Member_of Procedure member(a, [A B]). member(a, [B C]) :- member(a,c). logical sematics: For every value assigmet of A, B ad C, we have member(a,[b C]) if member(a,c); procedural sematics: Head of clause is procedure etry. Procedure body cosists of calls withi this procedure. Procedural Iterpretatio member(a, [A B]). member(a, [B C]) :- member(a,c). member is a recursive procedure member(a, [A B]). is the base case. Procedure exits with true if the elemet we are lookig for, A, is the first elemet i the list. It exits with false if we have reached the ed of the list member(a, [B C]) :- member(a,c). is the recursive case. If elemet A is ot the first elemet i the list, call member recursively with argumets A ad tail C Fall 18 CSCI 4430, A Milaova 35 Fall 18 CSCI 4430, A Milaova 36 6
7 Questio Questio 1. member(a, [A B]). 2. member(a, [B C]) :- member(a, C). 1. member(a, [A B]). 2. member(a, [B C]) :- member(a, C). Give all aswers to the followig query:?- member(a,[b, a, X]). Give all aswers to the followig query:?- member(a, [b a]). Aswer: Fall 18 CSCI 4430, A Milaova 37 Fall 18 CSCI 4430, A Milaova 38 Apped Procedure apped([ ], A, A). apped([a B], C, [A D]) :- apped(b,c,d). Build a list?- apped([a],[b],y). Y = [ a,b ]?- apped([a,b,c],[d,e],y). Y = [ a,b,c,d,e ] More Apped apped([ ], A, A). apped([a B], C, [A D]) :- apped(b,c,d). Break a list ito costituet parts?- apped(x,[b],[a,b]). X = [ a ]?- apped([a],y,[a,b]). Y = [ b ] Fall 18 CSCI 4430, A Milaova 39 Fall 18 CSCI 4430, A Milaova 40 More Apped More Apped? - apped(x,y,[a,b]). Geeratig a ubouded umber of lists?- apped(x,[b],y). X = [ ] Y = [b] ; X = [ _G604] Y = [ _G604, b] ; X = [ _G604, _G610] Y = [ _G604, _G610, b] ; Etc. Be careful whe usig apped with 2 ubouded argumets!!! Fall 18 CSCI 4430, A Milaova 41 Fall 18 CSCI 4430, A Milaova 42 7
8 Questio What does this procedure do: p([],[]). p([a B],[[A] Rest]) :- p(b,rest). Puts brackets aroud each elemet i the list?- p([a,b,c],y). Y = [ [a],[b],[c] ]. It ca also flatte a list:?- p(x,[[a],[b],[c]]). X = [ a,b,c ]. Fall 18 CSCI 4430, A Milaova 43 Commo Structure Processig a list: proc([],[]). proc([h T],[H1 T1]) :- f(h,h1),proc(t,t1). Base case: we have reached the ed of list. I our case, the result for [ ] is [ ]. Recursive case: result is [H1 T1]. H1 was obtaied by callig f(h,h1) --- processes elemet H ito result H1. T1 is the result of recursive call of proc o T. Fall 18 CSCI 4430, A Milaova 44 Today s Lecture Outlie Arithmetic Laguage costructs: facts, rules, queries Search tree, uificatio, backtrackig, backward chaiig Lists Arithmetic Fall 18 CSCI 4430, A Milaova 45 has all arithmetic operators Built-i predicate is is(x, 1+3) or more commoly we write X is 1+3 is forces evaluatio of 1+3:?- X is 1+3 X = 4 = is uificatio ot assigmet!?- X = 4-1 X = 4-1 % uifies X with 4-1!!! Fall 18 CSCI 4430, A Milaova 46 Arithmetic: Commo Pitfalls is is ot ivertible! That is, argumets o the right caot be uboud! 3 is 3 X. ERROR: is/2: Argumets are ot sufficietly istatiated This does t work either:?- X is 4, X = X+1. false. Why? What is goig o here? Exercise Write sum, which takes a list of itegers ad computes the sum of the itegers. E.g., sum([1,2,3],r).?- R = 6. How about if the itegers are arbitrarily ested? E.g., sum([[1],[[[2]],3]],r).?- R = 6. Fall 18 CSCI 4430, A Milaova 47 Fall 18 CSCI 4430, A Milaova 48 8
9 Exercise Write plus10, which takes a list of itegers ad computes aother list, where all itegers are shifted +10. E.g., plus10([1,2,3],r).?- R = [11,12,13]. Write le, which takes a list ad computes the legth of the list. E.g., le([1,[2],3],r).?- R = 3. Fall 18 CSCI 4430, A Milaova 49 Exercise Write atoms, which takes a list ad computes the umber of atoms i the list. E.g., atoms([a,[b,[[c]]]],r).?- R = 3. Hit: built-i predicate atom(x) yields true if X is a atom (i.e., symbolic costat such as x, abc, tom). Fall 18 CSCI 4430, A Milaova 50 9
n Bottom-up (LR) parsing n Handle n LR item n Characteristic Finite State Machine (CFSM) n SLR(1) parsing tables n Conflicts in SLR(1)
Aoucemets Quiz Hold o to paper, brig over at the ed HW due tomorrow (exteded 1 day) We have office hours -7pm today Dowload SWI Prolog! HW3 will be posted toight or tomorrow Prolog Due Fray, Sep 8 at pm
More informationLast class. n Scheme. n Equality testing. n eq? vs. equal? n Higher-order functions. n map, foldr, foldl. n Tail recursion
Aoucemets HW6 due today HW7 is out A team assigmet Submitty page will be up toight Fuctioal correctess: 75%, Commets : 25% Last class Equality testig eq? vs. equal? Higher-order fuctios map, foldr, foldl
More informationProlog. Intro to Logic Programming
Prolog Logic programming (declarative) Goals and subgoals Prolog Syntax Database example rule order, subgoal order, argument invertibility, backtracking model of execution, negation by failure, variables
More informationModule 8-7: Pascal s Triangle and the Binomial Theorem
Module 8-7: Pascal s Triagle ad the Biomial Theorem Gregory V. Bard April 5, 017 A Note about Notatio Just to recall, all of the followig mea the same thig: ( 7 7C 4 C4 7 7C4 5 4 ad they are (all proouced
More information9.1. Sequences and Series. Sequences. What you should learn. Why you should learn it. Definition of Sequence
_9.qxd // : AM Page Chapter 9 Sequeces, Series, ad Probability 9. Sequeces ad Series What you should lear Use sequece otatio to write the terms of sequeces. Use factorial otatio. Use summatio otatio to
More informationLecture 1: Introduction and Strassen s Algorithm
5-750: Graduate Algorithms Jauary 7, 08 Lecture : Itroductio ad Strasse s Algorithm Lecturer: Gary Miller Scribe: Robert Parker Itroductio Machie models I this class, we will primarily use the Radom Access
More informationCS 11 C track: lecture 1
CS 11 C track: lecture 1 Prelimiaries Need a CMS cluster accout http://acctreq.cms.caltech.edu/cgi-bi/request.cgi Need to kow UNIX IMSS tutorial liked from track home page Track home page: http://courses.cms.caltech.edu/courses/cs11/material
More informationSolutions to Final COMS W4115 Programming Languages and Translators Monday, May 4, :10-5:25pm, 309 Havemeyer
Departmet of Computer ciece Columbia Uiversity olutios to Fial COM W45 Programmig Laguages ad Traslators Moday, May 4, 2009 4:0-5:25pm, 309 Havemeyer Closed book, o aids. Do questios 5. Each questio is
More informationWhat are we going to learn? CSC Data Structures Analysis of Algorithms. Overview. Algorithm, and Inputs
What are we goig to lear? CSC316-003 Data Structures Aalysis of Algorithms Computer Sciece North Carolia State Uiversity Need to say that some algorithms are better tha others Criteria for evaluatio Structure
More informationExercise 6 (Week 42) For the foreign students only.
These are the last exercises of the course. Please, remember that to pass exercises, the sum of the poits gathered by solvig the questios ad attedig the exercise groups must be at least 4% ( poits) of
More informationNTH, GEOMETRIC, AND TELESCOPING TEST
NTH, GEOMETRIC, AND TELESCOPING TEST Sectio 9. Calculus BC AP/Dual, Revised 08 viet.dag@humbleisd.et /4/08 0:0 PM 9.: th, Geometric, ad Telescopig Test SUMMARY OF TESTS FOR SERIES Lookig at the first few
More informationCOP4020 Programming Languages. Functional Programming Prof. Robert van Engelen
COP4020 Programmig Laguages Fuctioal Programmig Prof. Robert va Egele Overview What is fuctioal programmig? Historical origis of fuctioal programmig Fuctioal programmig today Cocepts of fuctioal programmig
More informationRunning Time. Analysis of Algorithms. Experimental Studies. Limitations of Experiments
Ruig Time Aalysis of Algorithms Iput Algorithm Output A algorithm is a step-by-step procedure for solvig a problem i a fiite amout of time. Most algorithms trasform iput objects ito output objects. The
More informationPseudocode ( 1.1) Analysis of Algorithms. Primitive Operations. Pseudocode Details. Running Time ( 1.1) Estimating performance
Aalysis of Algorithms Iput Algorithm Output A algorithm is a step-by-step procedure for solvig a problem i a fiite amout of time. Pseudocode ( 1.1) High-level descriptio of a algorithm More structured
More informationRunning Time ( 3.1) Analysis of Algorithms. Experimental Studies. Limitations of Experiments
Ruig Time ( 3.1) Aalysis of Algorithms Iput Algorithm Output A algorithm is a step- by- step procedure for solvig a problem i a fiite amout of time. Most algorithms trasform iput objects ito output objects.
More informationAnalysis of Algorithms
Aalysis of Algorithms Iput Algorithm Output A algorithm is a step-by-step procedure for solvig a problem i a fiite amout of time. Ruig Time Most algorithms trasform iput objects ito output objects. The
More informationData Structures and Algorithms. Analysis of Algorithms
Data Structures ad Algorithms Aalysis of Algorithms Outlie Ruig time Pseudo-code Big-oh otatio Big-theta otatio Big-omega otatio Asymptotic algorithm aalysis Aalysis of Algorithms Iput Algorithm Output
More informationcondition w i B i S maximum u i
ecture 10 Dyamic Programmig 10.1 Kapsack Problem November 1, 2004 ecturer: Kamal Jai Notes: Tobias Holgers We are give a set of items U = {a 1, a 2,..., a }. Each item has a weight w i Z + ad a utility
More information. Written in factored form it is easy to see that the roots are 2, 2, i,
CMPS A Itroductio to Programmig Programmig Assigmet 4 I this assigmet you will write a java program that determies the real roots of a polyomial that lie withi a specified rage. Recall that the roots (or
More informationHomework 1 Solutions MA 522 Fall 2017
Homework 1 Solutios MA 5 Fall 017 1. Cosider the searchig problem: Iput A sequece of umbers A = [a 1,..., a ] ad a value v. Output A idex i such that v = A[i] or the special value NIL if v does ot appear
More informationLecture 5. Counting Sort / Radix Sort
Lecture 5. Coutig Sort / Radix Sort T. H. Corme, C. E. Leiserso ad R. L. Rivest Itroductio to Algorithms, 3rd Editio, MIT Press, 2009 Sugkyukwa Uiversity Hyuseug Choo choo@skku.edu Copyright 2000-2018
More informationOutline and Reading. Analysis of Algorithms. Running Time. Experimental Studies. Limitations of Experiments. Theoretical Analysis
Outlie ad Readig Aalysis of Algorithms Iput Algorithm Output Ruig time ( 3.) Pseudo-code ( 3.2) Coutig primitive operatios ( 3.3-3.) Asymptotic otatio ( 3.6) Asymptotic aalysis ( 3.7) Case study Aalysis
More informationHow do we evaluate algorithms?
F2 Readig referece: chapter 2 + slides Algorithm complexity Big O ad big Ω To calculate ruig time Aalysis of recursive Algorithms Next time: Litterature: slides mostly The first Algorithm desig methods:
More informationCSC 220: Computer Organization Unit 11 Basic Computer Organization and Design
College of Computer ad Iformatio Scieces Departmet of Computer Sciece CSC 220: Computer Orgaizatio Uit 11 Basic Computer Orgaizatio ad Desig 1 For the rest of the semester, we ll focus o computer architecture:
More informationMajor CSL Write your name and entry no on every sheet of the answer script. Time 2 Hrs Max Marks 70
NOTE:. Attempt all seve questios. Major CSL 02 2. Write your ame ad etry o o every sheet of the aswer script. Time 2 Hrs Max Marks 70 Q No Q Q 2 Q 3 Q 4 Q 5 Q 6 Q 7 Total MM 6 2 4 0 8 4 6 70 Q. Write a
More informationChapter 4 The Datapath
The Ageda Chapter 4 The Datapath Based o slides McGraw-Hill Additioal material 24/25/26 Lewis/Marti Additioal material 28 Roth Additioal material 2 Taylor Additioal material 2 Farmer Tae the elemets that
More informationimplement language system
Outlie Priciples of programmig laguages Lecture 3 http://few.vu.l/~silvis/ppl/2007 Part I. Laguage systems Part II. Fuctioal programmig. First look at ML. Natalia Silvis-Cividjia e-mail: silvis@few.vu.l
More informationCS200: Hash Tables. Prichard Ch CS200 - Hash Tables 1
CS200: Hash Tables Prichard Ch. 13.2 CS200 - Hash Tables 1 Table Implemetatios: average cases Search Add Remove Sorted array-based Usorted array-based Balaced Search Trees O(log ) O() O() O() O(1) O()
More informationHeaps. Presentation for use with the textbook Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, 2015
Presetatio for use with the textbook Algorithm Desig ad Applicatios, by M. T. Goodrich ad R. Tamassia, Wiley, 201 Heaps 201 Goodrich ad Tamassia xkcd. http://xkcd.com/83/. Tree. Used with permissio uder
More informationAnalysis of Algorithms
Aalysis of Algorithms Ruig Time of a algorithm Ruig Time Upper Bouds Lower Bouds Examples Mathematical facts Iput Algorithm Output A algorithm is a step-by-step procedure for solvig a problem i a fiite
More informationUniversity of Waterloo Department of Electrical and Computer Engineering ECE 250 Algorithms and Data Structures
Uiversity of Waterloo Departmet of Electrical ad Computer Egieerig ECE 250 Algorithms ad Data Structures Midterm Examiatio ( pages) Istructor: Douglas Harder February 7, 2004 7:30-9:00 Name (last, first)
More informationOnes Assignment Method for Solving Traveling Salesman Problem
Joural of mathematics ad computer sciece 0 (0), 58-65 Oes Assigmet Method for Solvig Travelig Salesma Problem Hadi Basirzadeh Departmet of Mathematics, Shahid Chamra Uiversity, Ahvaz, Ira Article history:
More informationProlog - 3 Prolog search trees + traces
Prolog - 3 Prolog search trees + traces 1 Review member(a, [A B]). member(a, [B C]) :- member (A,C). goal-oriented semantics: can get value assignment for goal member(a,[b C]) by showing truth of subgoal
More informationn n B. How many subsets of C are there of cardinality n. We are selecting elements for such a
4. [10] Usig a combiatorial argumet, prove that for 1: = 0 = Let A ad B be disjoit sets of cardiality each ad C = A B. How may subsets of C are there of cardiality. We are selectig elemets for such a subset
More informationCMPT 125 Assignment 2 Solutions
CMPT 25 Assigmet 2 Solutios Questio (20 marks total) a) Let s cosider a iteger array of size 0. (0 marks, each part is 2 marks) it a[0]; I. How would you assig a poiter, called pa, to store the address
More informationCOP4020 Programming Languages. Compilers and Interpreters Prof. Robert van Engelen
COP4020 mig Laguages Compilers ad Iterpreters Prof. Robert va Egele Overview Commo compiler ad iterpreter cofiguratios Virtual machies Itegrated developmet eviromets Compiler phases Lexical aalysis Sytax
More informationComputers and Scientific Thinking
Computers ad Scietific Thikig David Reed, Creighto Uiversity Chapter 15 JavaScript Strigs 1 Strigs as Objects so far, your iteractive Web pages have maipulated strigs i simple ways use text box to iput
More informationThe isoperimetric problem on the hypercube
The isoperimetric problem o the hypercube Prepared by: Steve Butler November 2, 2005 1 The isoperimetric problem We will cosider the -dimesioal hypercube Q Recall that the hypercube Q is a graph whose
More informationThompson s Group F (p + 1) is not Minimally Almost Convex
Thompso s Group F (p + ) is ot Miimally Almost Covex Claire Wladis Thompso s Group F (p + ). A Descriptio of F (p + ) Thompso s group F (p + ) ca be defied as the group of piecewiseliear orietatio-preservig
More informationExamples and Applications of Binary Search
Toy Gog ITEE Uiersity of Queeslad I the secod lecture last week we studied the biary search algorithm that soles the problem of determiig if a particular alue appears i a sorted list of iteger or ot. We
More informationComputational Geometry
Computatioal Geometry Chapter 4 Liear programmig Duality Smallest eclosig disk O the Ageda Liear Programmig Slides courtesy of Craig Gotsma 4. 4. Liear Programmig - Example Defie: (amout amout cosumed
More informationn Haskell n Covered syntax, lazy evaluation, static typing n Algebraic data types and pattern matching n Type classes n Monads and more n Types
Aoucemets Exam 2 is graded, but I will eed some time to go over it I ll release grades this eveig (figers crossed!) Raibow grades: HW1-6, Exam 1-2, Quiz 1-5 Will post aswer key Still gradig: Quiz 6, HW7
More informationn Haskell n Syntax n Lazy evaluation n Static typing and type inference n Algebraic data types n Pattern matching n Type classes
Aoucemets Quiz 7 HW 9 is due o Friday Raibow grades HW 1-6 plus 8. Please, read our commets o 8! Exam 1-2 Quiz 1-6 Ay questios/cocers, let us kow ASAP Last Class Haskell Sytax Lazy evaluatio Static typig
More informationAnnouncements. The idea of logic programming. Logical programming. Principles of programming languages Lecture nov and 7 december
Aoucemets Priciples of programmig laguages Lecture 8 http://few.vu.l/~silvis/ppl/2007 Natalia Silvis-Cividjia e-mail: silvis@few.vu.l Exam 19 dec moved to 15:15-18:00. Guest lecture moved to 14 dec. Deadlies
More information1 Graph Sparsfication
CME 305: Discrete Mathematics ad Algorithms 1 Graph Sparsficatio I this sectio we discuss the approximatio of a graph G(V, E) by a sparse graph H(V, F ) o the same vertex set. I particular, we cosider
More informationtop() Applications of Stacks
CS22 Algorithms ad Data Structures MW :00 am - 2: pm, MSEC 0 Istructor: Xiao Qi Lecture 6: Stacks ad Queues Aoucemets Quiz results Homework 2 is available Due o September 29 th, 2004 www.cs.mt.edu~xqicoursescs22
More informationLecture Notes 6 Introduction to algorithm analysis CSS 501 Data Structures and Object-Oriented Programming
Lecture Notes 6 Itroductio to algorithm aalysis CSS 501 Data Structures ad Object-Orieted Programmig Readig for this lecture: Carrao, Chapter 10 To be covered i this lecture: Itroductio to algorithm aalysis
More informationAlpha Individual Solutions MAΘ National Convention 2013
Alpha Idividual Solutios MAΘ Natioal Covetio 0 Aswers:. D. A. C 4. D 5. C 6. B 7. A 8. C 9. D 0. B. B. A. D 4. C 5. A 6. C 7. B 8. A 9. A 0. C. E. B. D 4. C 5. A 6. D 7. B 8. C 9. D 0. B TB. 570 TB. 5
More informationCS 111: Program Design I Lecture # 7: First Loop, Web Crawler, Functions
CS 111: Program Desig I Lecture # 7: First Loop, Web Crawler, Fuctios Robert H. Sloa & Richard Warer Uiversity of Illiois at Chicago September 18, 2018 What will this prit? x = 5 if x == 3: prit("hi!")
More informationCOMP Parallel Computing. PRAM (1): The PRAM model and complexity measures
COMP 633 - Parallel Computig Lecture 2 August 24, 2017 : The PRAM model ad complexity measures 1 First class summary This course is about parallel computig to achieve high-er performace o idividual problems
More informationOne advantage that SONAR has over any other music-sequencing product I ve worked
*gajedra* D:/Thomso_Learig_Projects/Garrigus_163132/z_productio/z_3B2_3D_files/Garrigus_163132_ch17.3d, 14/11/08/16:26:39, 16:26, page: 647 17 CAL 101 Oe advatage that SONAR has over ay other music-sequecig
More informationLast Class. Announcements. Lecture Outline. Types. Structural Equivalence. Type Equivalence. Read: Scott, Chapters 7 and 8. T2 y; x = y; n Types
Aoucemets HW9 due today HW10 comig up, will post after class Team assigmet Data abstractio (types) ad cotrol abstractio (parameter passig) Due o Tuesday, November 27 th Last Class Types Type systems Type
More informationSome non-existence results on Leech trees
Some o-existece results o Leech trees László A.Székely Hua Wag Yog Zhag Uiversity of South Carolia This paper is dedicated to the memory of Domiique de Cae, who itroduced LAS to Leech trees.. Abstract
More informationAnalysis Metrics. Intro to Algorithm Analysis. Slides. 12. Alg Analysis. 12. Alg Analysis
Itro to Algorithm Aalysis Aalysis Metrics Slides. Table of Cotets. Aalysis Metrics 3. Exact Aalysis Rules 4. Simple Summatio 5. Summatio Formulas 6. Order of Magitude 7. Big-O otatio 8. Big-O Theorems
More informationCIS 121 Data Structures and Algorithms with Java Spring Stacks, Queues, and Heaps Monday, February 18 / Tuesday, February 19
CIS Data Structures ad Algorithms with Java Sprig 09 Stacks, Queues, ad Heaps Moday, February 8 / Tuesday, February 9 Stacks ad Queues Recall the stack ad queue ADTs (abstract data types from lecture.
More informationData Structures Week #5. Trees (Ağaçlar)
Data Structures Week #5 Trees Ağaçlar) Trees Ağaçlar) Toros Gökarı Avrupa Gökarı October 28, 2014 Boraha Tümer, Ph.D. 2 Trees Ağaçlar) October 28, 2014 Boraha Tümer, Ph.D. 3 Outlie Trees Deiitios Implemetatio
More informationBehavioral Modeling in Verilog
Behavioral Modelig i Verilog COE 202 Digital Logic Desig Dr. Muhamed Mudawar Kig Fahd Uiversity of Petroleum ad Mierals Presetatio Outlie Itroductio to Dataflow ad Behavioral Modelig Verilog Operators
More informationBig-O Analysis. Asymptotics
Big-O Aalysis 1 Defiitio: Suppose that f() ad g() are oegative fuctios of. The we say that f() is O(g()) provided that there are costats C > 0 ad N > 0 such that for all > N, f() Cg(). Big-O expresses
More informationComputer Science Foundation Exam. August 12, Computer Science. Section 1A. No Calculators! KEY. Solutions and Grading Criteria.
Computer Sciece Foudatio Exam August, 005 Computer Sciece Sectio A No Calculators! Name: SSN: KEY Solutios ad Gradig Criteria Score: 50 I this sectio of the exam, there are four (4) problems. You must
More information1.2 Binomial Coefficients and Subsets
1.2. BINOMIAL COEFFICIENTS AND SUBSETS 13 1.2 Biomial Coefficiets ad Subsets 1.2-1 The loop below is part of a program to determie the umber of triagles formed by poits i the plae. for i =1 to for j =
More informationBig-O Analysis. Asymptotics
Big-O Aalysis 1 Defiitio: Suppose that f() ad g() are oegative fuctios of. The we say that f() is O(g()) provided that there are costats C > 0 ad N > 0 such that for all > N, f() Cg(). Big-O expresses
More informationA SOFTWARE MODEL FOR THE MULTILAYER PERCEPTRON
A SOFTWARE MODEL FOR THE MULTILAYER PERCEPTRON Roberto Lopez ad Eugeio Oñate Iteratioal Ceter for Numerical Methods i Egieerig (CIMNE) Edificio C1, Gra Capitá s/, 08034 Barceloa, Spai ABSTRACT I this work
More information( n+1 2 ) , position=(7+1)/2 =4,(median is observation #4) Median=10lb
Chapter 3 Descriptive Measures Measures of Ceter (Cetral Tedecy) These measures will tell us where is the ceter of our data or where most typical value of a data set lies Mode the value that occurs most
More informationThe number n of subintervals times the length h of subintervals gives length of interval (b-a).
Simulator with MadMath Kit: Riema Sums (Teacher s pages) I your kit: 1. GeoGebra file: Ready-to-use projector sized simulator: RiemaSumMM.ggb 2. RiemaSumMM.pdf (this file) ad RiemaSumMMEd.pdf (educator's
More information10/23/18. File class in Java. Scanner reminder. Files. Opening a file for reading. Scanner reminder. File Input and Output
File class i Java File Iput ad Output TOPICS File Iput Exceptio Hadlig File Output Programmers refer to iput/output as "I/O". The File class represets files as objects. The class is defied i the java.io
More informationSolution printed. Do not start the test until instructed to do so! CS 2604 Data Structures Midterm Spring, Instructions:
CS 604 Data Structures Midterm Sprig, 00 VIRG INIA POLYTECHNIC INSTITUTE AND STATE U T PROSI M UNI VERSI TY Istructios: Prit your ame i the space provided below. This examiatio is closed book ad closed
More information9 x and g(x) = 4. x. Find (x) 3.6. I. Combining Functions. A. From Equations. Example: Let f(x) = and its domain. Example: Let f(x) = and g(x) = x x 4
1 3.6 I. Combiig Fuctios A. From Equatios Example: Let f(x) = 9 x ad g(x) = 4 f x. Fid (x) g ad its domai. 4 Example: Let f(x) = ad g(x) = x x 4. Fid (f-g)(x) B. From Graphs: Graphical Additio. Example:
More informationCIS 121 Data Structures and Algorithms with Java Fall Big-Oh Notation Tuesday, September 5 (Make-up Friday, September 8)
CIS 11 Data Structures ad Algorithms with Java Fall 017 Big-Oh Notatio Tuesday, September 5 (Make-up Friday, September 8) Learig Goals Review Big-Oh ad lear big/small omega/theta otatios Practice solvig
More informationCSC165H1 Worksheet: Tutorial 8 Algorithm analysis (SOLUTIONS)
CSC165H1, Witer 018 Learig Objectives By the ed of this worksheet, you will: Aalyse the ruig time of fuctios cotaiig ested loops. 1. Nested loop variatios. Each of the followig fuctios takes as iput a
More informationUNIT 4 Section 8 Estimating Population Parameters using Confidence Intervals
UNIT 4 Sectio 8 Estimatig Populatio Parameters usig Cofidece Itervals To make ifereces about a populatio that caot be surveyed etirely, sample statistics ca be take from a SRS of the populatio ad used
More informationChapter 9. Pointers and Dynamic Arrays. Copyright 2015 Pearson Education, Ltd.. All rights reserved.
Chapter 9 Poiters ad Dyamic Arrays Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 9.1 Poiters 9.2 Dyamic Arrays Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Slide 9-3
More informationMatrix representation of a solution of a combinatorial problem of the group theory
Matrix represetatio of a solutio of a combiatorial problem of the group theory Krasimir Yordzhev, Lilyaa Totia Faculty of Mathematics ad Natural Scieces South-West Uiversity 66 Iva Mihailov Str, 2700 Blagoevgrad,
More informationDesigning a learning system
CS 75 Machie Learig Lecture Desigig a learig system Milos Hauskrecht milos@cs.pitt.edu 539 Seott Square, x-5 people.cs.pitt.edu/~milos/courses/cs75/ Admiistrivia No homework assigmet this week Please try
More informationChapter 1. Introduction to Computers and C++ Programming. Copyright 2015 Pearson Education, Ltd.. All rights reserved.
Chapter 1 Itroductio to Computers ad C++ Programmig Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 1.1 Computer Systems 1.2 Programmig ad Problem Solvig 1.3 Itroductio to C++ 1.4 Testig
More informationEE University of Minnesota. Midterm Exam #1. Prof. Matthew O'Keefe TA: Eric Seppanen. Department of Electrical and Computer Engineering
EE 4363 1 Uiversity of Miesota Midterm Exam #1 Prof. Matthew O'Keefe TA: Eric Seppae Departmet of Electrical ad Computer Egieerig Uiversity of Miesota Twi Cities Campus EE 4363 Itroductio to Microprocessors
More informationCS211 Fall 2003 Prelim 2 Solutions and Grading Guide
CS11 Fall 003 Prelim Solutios ad Gradig Guide Problem 1: (a) obj = obj1; ILLEGAL because type of referece must always be a supertype of type of object (b) obj3 = obj1; ILLEGAL because type of referece
More informationCopyright 2016 Ramez Elmasri and Shamkant B. Navathe
Copyright 2016 Ramez Elmasri ad Shamkat B. Navathe CHAPTER 18 Strategies for Query Processig Copyright 2016 Ramez Elmasri ad Shamkat B. Navathe Itroductio DBMS techiques to process a query Scaer idetifies
More informationRecursion. Computer Science S-111 Harvard University David G. Sullivan, Ph.D. Review: Method Frames
Uit 4, Part 3 Recursio Computer Sciece S-111 Harvard Uiversity David G. Sulliva, Ph.D. Review: Method Frames Whe you make a method call, the Java rutime sets aside a block of memory kow as the frame of
More informationFREQUENCY ESTIMATION OF INTERNET PACKET STREAMS WITH LIMITED SPACE: UPPER AND LOWER BOUNDS
FREQUENCY ESTIMATION OF INTERNET PACKET STREAMS WITH LIMITED SPACE: UPPER AND LOWER BOUNDS Prosejit Bose Evagelos Kraakis Pat Mori Yihui Tag School of Computer Sciece, Carleto Uiversity {jit,kraakis,mori,y
More informationWebAssign Lesson 6-1b Geometric Series (Homework)
WebAssig Lesso 6-b Geometric Series (Homework) Curret Score : / 49 Due : Wedesday, July 30 204 :0 AM MDT Jaimos Skriletz Math 75, sectio 3, Summer 2 204 Istructor: Jaimos Skriletz. /2 poitsrogac alcet2
More informationCIS 121. Introduction to Trees
CIS 121 Itroductio to Trees 1 Tree ADT Tree defiitio q A tree is a set of odes which may be empty q If ot empty, the there is a distiguished ode r, called root ad zero or more o-empty subtrees T 1, T 2,
More information3. b. Present a combinatorial argument that for all positive integers n : : 2 n
. b. Preset a combiatorial argumet that for all positive itegers : : Cosider two distict sets A ad B each of size. Sice they are distict, the cardiality of A B is. The umber of ways of choosig a pair of
More informationCombination Labelings Of Graphs
Applied Mathematics E-Notes, (0), - c ISSN 0-0 Available free at mirror sites of http://wwwmaththuedutw/ame/ Combiatio Labeligs Of Graphs Pak Chig Li y Received February 0 Abstract Suppose G = (V; E) is
More informationPython Programming: An Introduction to Computer Science
Pytho Programmig: A Itroductio to Computer Sciece Chapter 1 Computers ad Programs 1 Objectives To uderstad the respective roles of hardware ad software i a computig system. To lear what computer scietists
More informationCh 9.3 Geometric Sequences and Series Lessons
Ch 9.3 Geometric Sequeces ad Series Lessos SKILLS OBJECTIVES Recogize a geometric sequece. Fid the geeral, th term of a geometric sequece. Evaluate a fiite geometric series. Evaluate a ifiite geometric
More informationArithmetic Sequences
. Arithmetic Sequeces COMMON CORE Learig Stadards HSF-IF.A. HSF-BF.A.1a HSF-BF.A. HSF-LE.A. Essetial Questio How ca you use a arithmetic sequece to describe a patter? A arithmetic sequece is a ordered
More informationCopyright 2016 Ramez Elmasri and Shamkant B. Navathe
Copyright 2016 Ramez Elmasri ad Shamkat B. Navathe CHAPTER 26 Ehaced Data Models: Itroductio to Active, Temporal, Spatial, Multimedia, ad Deductive Databases Copyright 2016 Ramez Elmasri ad Shamkat B.
More informationLecture 6. Lecturer: Ronitt Rubinfeld Scribes: Chen Ziv, Eliav Buchnik, Ophir Arie, Jonathan Gradstein
068.670 Subliear Time Algorithms November, 0 Lecture 6 Lecturer: Roitt Rubifeld Scribes: Che Ziv, Eliav Buchik, Ophir Arie, Joatha Gradstei Lesso overview. Usig the oracle reductio framework for approximatig
More informationData diverse software fault tolerance techniques
Data diverse software fault tolerace techiques Complemets desig diversity by compesatig for desig diversity s s limitatios Ivolves obtaiig a related set of poits i the program data space, executig the
More informationRandom Graphs and Complex Networks T
Radom Graphs ad Complex Networks T-79.7003 Charalampos E. Tsourakakis Aalto Uiversity Lecture 3 7 September 013 Aoucemet Homework 1 is out, due i two weeks from ow. Exercises: Probabilistic iequalities
More informationOn Infinite Groups that are Isomorphic to its Proper Infinite Subgroup. Jaymar Talledo Balihon. Abstract
O Ifiite Groups that are Isomorphic to its Proper Ifiite Subgroup Jaymar Talledo Baliho Abstract Two groups are isomorphic if there exists a isomorphism betwee them Lagrage Theorem states that the order
More informationAbstract. Chapter 4 Computation. Overview 8/13/18. Bjarne Stroustrup Note:
Chapter 4 Computatio Bjare Stroustrup www.stroustrup.com/programmig Abstract Today, I ll preset the basics of computatio. I particular, we ll discuss expressios, how to iterate over a series of values
More informationProject 2.5 Improved Euler Implementation
Project 2.5 Improved Euler Implemetatio Figure 2.5.10 i the text lists TI-85 ad BASIC programs implemetig the improved Euler method to approximate the solutio of the iitial value problem dy dx = x+ y,
More informationNew Results on Energy of Graphs of Small Order
Global Joural of Pure ad Applied Mathematics. ISSN 0973-1768 Volume 13, Number 7 (2017), pp. 2837-2848 Research Idia Publicatios http://www.ripublicatio.com New Results o Eergy of Graphs of Small Order
More informationAssignment 5; Due Friday, February 10
Assigmet 5; Due Friday, February 10 17.9b The set X is just two circles joied at a poit, ad the set X is a grid i the plae, without the iteriors of the small squares. The picture below shows that the iteriors
More informationWhat does JFC stand for?
IS4300 HCI No-Quiz What does JFC stad for?! Java Fudametal Classes! Java Foudatio Creator! Java Fried Chicke! Java Foudatio Classes! Java Framework Creator 1 No-Quiz What is pluggable look ad feel?! Swig
More informationFrom last week. Lecture 5. Outline. Principles of programming languages
Priciples of programmig laguages From last week Lecture 5 http://few.vu.l/~silvis/ppl/2007 Natalia Silvis-Cividjia e-mail: silvis@few.vu.l ML has o assigmet. Explai how to access a old bidig? Is & for
More informationthe beginning of the program in order for it to work correctly. Similarly, a Confirm
I our sytax, a Assume statemet will be used to record what must be true at the begiig of the program i order for it to work correctly. Similarly, a Cofirm statemet is used to record what should be true
More informationABOUT A CONSTRUCTION PROBLEM
INTERNATIONAL JOURNAL OF GEOMETRY Vol 3 (014), No, 14 19 ABOUT A CONSTRUCTION PROBLEM OVIDIU T POP ad SÁNDOR N KISS Abstract I this paper, we study the costructio of a polygo if we kow the midpoits of
More informationAnalysis of Algorithms
Presetatio for use with the textbook, Algorithm Desig ad Applicatios, by M. T. Goodrich ad R. Tamassia, Wiley, 2015 Aalysis of Algorithms Iput 2015 Goodrich ad Tamassia Algorithm Aalysis of Algorithms
More information