L2-Python-Data-Structures

Size: px
Start display at page:

Download "L2-Python-Data-Structures"

Transcription

1 L2-Python-Dt-Structures Mrch 19, Principl built-in types in Python (Python ) numerics: int, flot, long, complex sequences: str, unicode, list, tuple, byterry, buffer, xrnge mppings: dict files: clsses: instnces: exceptions: 2 Lists The list dt type hs some more methods. Here re ll of the methods of list objects in Python 3: list.ppend(x) Add n item to the end of the list. Equivlent to [len():] = [x]. In [1]: = [1, 2, 4, 5,8, 100,1005] In [2]:.ppend(2) Out[2]: [1, 2, 4, 5, 8, 100, 1005, 2] list.extend(l) Extend the list by ppending ll the items in the given list. Equivlent to [len():] = L. In [3]: b = ["Feng", "Li", "Love"].extend(b) Out[3]: [1, 2, 4, 5, 8, 100, 1005, 2, 'Feng', 'Li', 'Love'] list.insert(i, x) Insert n item t given position. The first rgument is the index of the element before which to insert, so.insert(0, x) inserts t the front of the list, nd.insert(len(), x) is equivlent to.ppend(x). 1

2 In [4]:.insert(1,"Hello") Out[4]: [1, 'Hello', 2, 4, 5, 8, 100, 1005, 2, 'Feng', 'Li', 'Love'] list.remove(x) Remove the first item from the list whose vlue is x. It is n error if there is no such item. list.pop([i]) Remove the item t the given position in the list, nd return it. If no index is specified,.pop() removes nd returns the lst item in the list. (The squre brckets round the i in the method signture denote tht the prmeter is optionl, not tht you should type squre brckets t tht position. You will see this nottion frequently in the Python Librry Reference.) list.cler() Remove ll items from the list. Equivlent to del [:]. In [5]:.pop(2) Out[5]: [1, 'Hello', 4, 5, 8, 100, 1005, 2, 'Feng', 'Li', 'Love'] In [6]:.pop() Out[6]: [1, 'Hello', 4, 5, 8, 100, 1005, 2, 'Feng', 'Li'] In [7]:.remove("Hello") Out[7]: [1, 4, 5, 8, 100, 1005, 2, 'Feng', 'Li'] list.index(x) Return the index in the list of the first item whose vlue is x. It is n error if there is no such item. list.count(x) Return the number of times x ppers in the list. list.sort() Sort the items of the list in plce. In [5]:.ppend("Love") In [6]:.index("Love") Out[6]: 11 In [7]:.count("Love") Out[7]: 2 2

3 In [8]: b = [1,7,2,14] b.sort() b Out[8]: [1, 2, 7, 14] list.reverse() Reverse the elements of the list in plce. list.copy() Return shllow copy of the list. Equivlent to [:]. In [12]:.reverse() Out[12]: ['Love', 'Li', 'Feng', 2, 1005, 100, 8, 5, 4, 1] In [13]: b =.copy() b Out[13]: ['Love', 'Li', 'Feng', 2, 1005, 100, 8, 5, 4, 1] The del sttement There is wy to remove n item from list given its index insted of its vlue: the del sttement. This differs from the pop() method which returns vlue. The del sttement cn lso be used to remove slices from list or cler the entire list In [9]: Out[9]: [1, 'Hello', 2, 4, 5, 8, 100, 1005, 2, 'Feng', 'Li', 'Love', 'Love'] In [10]: del [2] Out[10]: [1, 'Hello', 4, 5, 8, 100, 1005, 2, 'Feng', 'Li', 'Love', 'Love'] del cn lso be used to delete entire vribles In [16]: del # will not be there 2.1 Vribles nd pss-by-reference When ssigning vrible (or nme) in Python, you re creting reference to the object on the right hnd side of the equls sign. In [14]: = [1,2,3,4] b = print() print(b) 3

4 [1, 2, 3, 4] [1, 2, 3, 4] In [15]:.ppend(100) print() print(b) [1, 2, 3, 4, 100] [1, 2, 3, 4, 100] Understnding the semntics of references in Python nd when, how, nd why dt is copied is especilly criticl when working with lrger dt sets in Python. If you relly need to mke hrd copy, use method like list.copy() In [18]: c1 =.copy() c2 = [:].ppend(23232) print() print(c1) print(c2) [1, 2, 3, 4, 100, 23232] [1, 2, 3, 4, 100] [1, 2, 3, 4, 100] 2.2 Using Lists s Stcks The list methods mke it very esy to use list s stck, where the lst element dded is the first element retrieved ( lst-in, first-out ). To dd n item to the top of the stck, use ppend(). To retrieve n item from the top of the stck, use pop() without n explicit index In [19]: stck = [3, 4, 5] In [20]: stck.ppend(2) stck Out[20]: [3, 4, 5, 2] In [21]: stck.pop() stck Out[21]: [3, 4, 5] 4

5 2.3 Using Lists s Queues It is lso possible to use list s queue, where the first element dded is the first element retrieved ( first-in, first-out ); however, lists re not efficient for this purpose. To implement queue, use collections.deque which ws designed to hve fst ppends nd pops from both ends. For exmple: In [22]: from collections import deque queue = deque(["eric", "John", "Michel"]) queue.ppend("terry") # Terry rrives queue.ppend("grhm") # Grhm rrives queue Out[22]: deque(['eric', 'John', 'Michel', 'Terry', 'Grhm']) In [23]: queue.popleft() queue.popleft() queue # The first to rrive now leves # The second to rrive now leves Out[23]: deque(['michel', 'Terry', 'Grhm']) 2.4 List Comprehensions List comprehensions provide concise wy to crete lists. Common pplictions re to mke new lists where ech element is the result of some opertions pplied to ech member of nother sequence or iterble, or to crete subsequence of those elements tht stisfy certin condition. In [16]: squres = [] # the usul wy for x in rnge(10): squres.ppend(x**2) squres Out[16]: [0, 1, 4, 9, 16, 25, 36, 49, 64, 81] We cn clculte the list of squres without ny side effects using the following. This is very similr to R progrmming lnguge s pply type functions. In [17]: squres = [x**2 for x in rnge(10)] squres Out[17]: [0, 1, 4, 9, 16, 25, 36, 49, 64, 81] which eventully did this In [18]: import mth squres = list(mp(lmbd x: mth.exp(x), rnge(10))) squres 5

6 Out[18]: [1.0, , , , , , , , , ] A list comprehension consists of brckets contining n expression followed by for cluse, then zero or more for or if cluses. The result will be new list resulting from evluting the expression in the context of the for nd if cluses which follow it. In [27]: [(x, y) for x in [1,2,3] for y in [3,1,4] if x!= y] Out[27]: [(1, 3), (1, 4), (2, 3), (2, 1), (2, 4), (3, 1), (3, 4)] which is equivlent to: In [28]: combs = [] for x in [1,2,3]: for y in [3,1,4]: if x!= y: combs.ppend((x, y)) combs Out[28]: [(1, 3), (1, 4), (2, 3), (2, 1), (2, 4), (3, 1), (3, 4)] 2.5 Nested List Comprehensions The initil expression in list comprehension cn be ny rbitrry expression, including nother list comprehension. In [29]: mtrix = [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]] mtrix Out[29]: [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]] The following list comprehension will trnspose rows nd columns: In [30]: [[row[i] for row in mtrix] for i in rnge(4)] Out[30]: [[1, 5, 9], [2, 6, 10], [3, 7, 11], [4, 8, 12]] the mgic behind this ws 6

7 In [31]: trnsposed = [] for i in rnge(4): trnsposed.ppend([row[i] for row in mtrix]) trnsposed Out[31]: [[1, 5, 9], [2, 6, 10], [3, 7, 11], [4, 8, 12]] In the rel world, you should prefer built-in functions to complex flow sttements. The zip() function would do gret job for this use cse: In [32]: list(zip(*mtrix)) Out[32]: [(1, 5, 9), (2, 6, 10), (3, 7, 11), (4, 8, 12)] 3 Tuples A tuple consists of number of vlues seprted by comms In [33]: t = 12345, 54321, 'hello!' t[0] Out[33]: In [34]: t Out[34]: (12345, 54321, 'hello!') Tuples my be nested nd tuples re immutble, but they cn contin mutble objects. In [35]: u = t, (1, 2, 3, 4, 5) u Out[35]: ((12345, 54321, 'hello!'), (1, 2, 3, 4, 5)) In [36]: v = ([1, 2, 3], [3, 2, 1]) v Out[36]: ([1, 2, 3], [3, 2, 1]) Note On output tuples re lwys enclosed in prentheses, so tht nested tuples re interpreted correctly; they my be input with or without surrounding prentheses, lthough often prentheses re necessry nywy (if the tuple is prt of lrger expression). It is not possible to ssign to the individul items of tuple, however it is possible to crete tuples which contin mutble objects, such s lists. 7

8 4 Dictionries Unlike sequences, which re indexed by rnge of numbers, dictionries re indexed by keys. Dictionries re sometimes found in other lnguges s ssocitive memories'' orssocitive rrys. The keys cn be ny immutble type; strings nd numbers cn lwys be keys. Tuples cn be used s keys if they contin only strings, numbers, or tuples; if tuple contins ny mutble object either directly or indirectly, it cnnot be used s key. You cn t use lists s keys. It is best to think of dictionry s n unordered set of key:vlue pirs, with the requirement tht the keys re unique (within one dictionry). A pir of brces cretes n empty dictionry: {}. Plcing comm-seprted list of key:vlue pirs within the brces dds initil key:vlue pirs to the dictionry; this is lso the wy dictionries re written on output. The min opertions on dictionry re storing vlue with some key nd extrcting the vlue given the key. In [19]: tel = {'jck': 4098, 'spe': 4139} tel['guido'] = 4127 print(tel) {'guido': 4127, 'jck': 4098, 'spe': 4139} The dict() constructor builds dictionries directly from sequences of key:vlue pirs: In [38]: dict([('spe', 4139), ('guido', 4127), ('jck', 4098)]) Out[38]: {'guido': 4127, 'jck': 4098, 'spe': 4139} When the keys re simple strings, it is sometimes esier to specify pirs using keyword rguments: In [39]: dict(spe=4139, guido=4127, jck=4098) Out[39]: {'guido': 4127, 'jck': 4098, 'spe': 4139} In [20]: list(tel.keys()) Out[20]: ['guido', 'jck', 'spe'] In [21]: sorted(tel.keys()) Out[21]: ['guido', 'jck', 'spe'] In [22]: 'guido' in tel Out[22]: True In [23]: 'jck' not in tel Out[23]: Flse 8

9 It is lso possible to delete key:vlue pir with del. If you store using key tht is lredy in use, the old vlue ssocited with tht key is forgotten. It is n error to extrct vlue using non-existent key. In [25]: del tel['spe'] tel KeyError Trcebck (most recent cll lst) <ipython-input-25-23bb8c95821> in <module>() ----> 1 del tel['spe'] 2 tel KeyError: 'spe' dict comprehensions cn be used to crete dictionries from rbitrry key nd vlue expressions: In [26]: {x: x**2 for x in (2, 4, 6)} Out[26]: {2: 4, 4: 16, 6: 36} 5 Sets A set is n unordered collection with no duplicte elements. Bsic uses include membership testing nd eliminting duplicte entries. Set objects lso support mthemticl opertions like union, intersection, difference, nd symmetric difference. Curly brces {} or the set() function cn be used to crete sets. Note: to crete n empty set you hve to use set(), not {}; the ltter cretes n empty dictionry. In [46]: bsket = {'pple', 'ornge', 'pple', 'per', 'ornge', 'bnn'} print(bsket) # show tht duplictes hve been removed {'pple', 'per', 'ornge', 'bnn'} In [47]: 'ornge' in bsket Out[47]: True In [48]: = set('brcdbr') b = set('lczm') print() print(b) 9

10 {'c', 'b', '', 'd', 'r'} {'c', 'm', 'l', '', 'z'} In [49]: - b Out[49]: {'b', 'd', 'r'} In [50]: b Out[50]: {'', 'b', 'c', 'd', 'l', 'm', 'r', 'z'} In [51]: & b Out[51]: {'', 'c'} In [52]: ^ b # XOR: exclusive OR Out[52]: {'b', 'd', 'l', 'm', 'r', 'z'} In [53]: = {x for x in 'brcdbr' if x not in 'bc'} # set comprehensions In [54]: Out[54]: {'d', 'r'} 6 Looping When looping through dictionries, the key nd corresponding vlue cn be retrieved t the sme time using the items() method. In [55]: knights = {'gllhd': 'the pure', 'robin': 'the brve'} for k, v in knights.items(): print(k, v) robin the brve gllhd the pure When looping through sequence, the position index nd corresponding vlue cn be retrieved t the sme time using the enumerte() function. In [56]: for i, v in enumerte(['tic', 'tc', 'toe']): print(i, v) 0 tic 1 tc 2 toe 10

11 To loop over two or more sequences t the sme time, the entries cn be pired with the zip() function. In [57]: questions = ['nme', 'quest', 'fvorite color'] nswers = ['lncelot', 'the holy gril', 'blue'] for q, in zip(questions, nswers): print('wht is your {0}? It is {1}.'.formt(q, )) Wht is your nme? It is lncelot. Wht is your quest? It is the holy gril. Wht is your fvorite color? It is blue. To loop over sequence in reverse, first specify the sequence in forwrd direction nd then cll the reversed() function. In [58]: for i in reversed(rnge(1, 10, 2)): print(i) To loop over sequence in sorted order, use the sorted() function which returns new sorted list while leving the source unltered. In [59]: bsket = ['pple', 'ornge', 'pple', 'per', 'ornge', 'bnn'] for f in sorted(set(bsket)): print(f) pple bnn ornge per To chnge sequence you re iterting over while inside the loop (for exmple to duplicte certin items), it is recommended tht you first mke copy. Looping over sequence does not implicitly mke copy. The slice nottion mkes this especilly convenient: In [60]: words = ['ct', 'window', 'defenestrte'] for w in words[:]: # Loop over slice copy of the entire list. if len(w) > 6: words.insert(0, w) words 11

12 Out[60]: ['defenestrte', 'ct', 'window', 'defenestrte'] In [ ]: words2 = ['ct', 'window', 'defenestrte'] for w in words2: # No copies. if len(w) > 6: words2.insert(0, w) words2 7 Conditions The conditions used in while nd if sttements cn contin ny opertors, not just comprisons. The comprison opertors in nd not in check whether vlue occurs (does not occur) in sequence. The opertors is nd is not compre whether two objects re relly the sme object; this only mtters for mutble objects like lists. All comprison opertors hve the sme priority, which is lower thn tht of ll numericl opertors. Comprisons cn be chined. For exmple, < b == c tests whether is less thn b nd moreover b equls c. Comprisons my be combined using the Boolen opertors, nd nd or, nd the outcome of comprison (or of ny other Boolen expression) my be negted with not. These hve lower priorities thn comprison opertors; between them, not hs the highest priority nd or the lowest, so tht A nd not B or C is equivlent to ((A nd (not B)) or C). As lwys, prentheses cn be used to express the desired composition. The Boolen opertors nd nd or re so-clled short-circuit opertors: their rguments re evluted from left to right, nd evlution stops s soon s the outcome is determined. For exmple, if A nd C re true but B is flse, A nd B nd C does not evlute the expression C. When used s generl vlue nd not s Boolen, the return vlue of short-circuit opertor is the lst evluted rgument. Keyword (Sclr) Function Bitwise True if nd logicl_nd() & Both True or logicl_or() Either or Both True not logicl_not() ~ Not True logicl_xor() ^ One True nd One Flse 7.1 Logicl Opertors The core logicl opertors re Greter thn: >, greter() Greter thn or equl to: >=, greter_equl() Less thn: <, less() Less thn or equl to: <= less_equl() Equl to: == equl() Not equl to:!= not_equl All comprisons re done element-by-element nd return either True or Flse. Note tht in Python, unlike C, ssignment cnnot occur inside expressions. it voids common clss of problems encountered in C progrms: typing = in n expression when == ws intended. 12

13 7.2 Multiple tests The functions ll nd ny tke logicl input nd re self-descriptive. ll returns True if ll logicl elements in n rry re 1. If ll is clled without ny dditionl rguments on n rry, it returns True if ll elements of the rry re logicl true nd 0 otherwise. ny returns logicl(true) if ny element of n rry is True. 7.3 is* is A number of specil purpose logicl tests re provided to determine if n rry hs specil chrcteristics. Some operte element-by-element nd produce n rry of the sme dimension s the input while other produce only sclrs. These functions ll begin with is. isnn isinf isfinite isposfin, isnegfin isrel iscomplex isrel is_string_like is_numlike issclr isvector 13

10/9/2012. Operator is an operation performed over data at runtime. Arithmetic, Logical, Comparison, Assignment, Etc. Operators have precedence

10/9/2012. Operator is an operation performed over data at runtime. Arithmetic, Logical, Comparison, Assignment, Etc. Operators have precedence /9/22 P f Performing i Si Simple l Clcultions C l l ti with ith C#. Opertors in C# nd Opertor Precedence 2. Arithmetic Opertors 3. Logicl Opertors 4. Bitwise Opertors 5. Comprison Opertors 6. Assignment

More information

Functor (1A) Young Won Lim 10/5/17

Functor (1A) Young Won Lim 10/5/17 Copyright (c) 2016-2017 Young W. Lim. Permission is grnted to copy, distribute nd/or modify this document under the terms of the GNU Free Documenttion License, Version 1.2 or ny lter version published

More information

Functor (1A) Young Won Lim 8/2/17

Functor (1A) Young Won Lim 8/2/17 Copyright (c) 2016-2017 Young W. Lim. Permission is grnted to copy, distribute nd/or modify this document under the terms of the GNU Free Documenttion License, Version 1.2 or ny lter version published

More information

CS201 Discussion 10 DRAWTREE + TRIES

CS201 Discussion 10 DRAWTREE + TRIES CS201 Discussion 10 DRAWTREE + TRIES DrwTree First instinct: recursion As very generic structure, we could tckle this problem s follows: drw(): Find the root drw(root) drw(root): Write the line for the

More information

Reference types and their characteristics Class Definition Constructors and Object Creation Special objects: Strings and Arrays

Reference types and their characteristics Class Definition Constructors and Object Creation Special objects: Strings and Arrays Objects nd Clsses Reference types nd their chrcteristics Clss Definition Constructors nd Object Cretion Specil objects: Strings nd Arrys OOAD 1999/2000 Cludi Niederée, Jochim W. Schmidt Softwre Systems

More information

Spring 2018 Midterm Exam 1 March 1, You may not use any books, notes, or electronic devices during this exam.

Spring 2018 Midterm Exam 1 March 1, You may not use any books, notes, or electronic devices during this exam. 15-112 Spring 2018 Midterm Exm 1 Mrch 1, 2018 Nme: Andrew ID: Recittion Section: You my not use ny books, notes, or electronic devices during this exm. You my not sk questions bout the exm except for lnguge

More information

4452 Mathematical Modeling Lecture 4: Lagrange Multipliers

4452 Mathematical Modeling Lecture 4: Lagrange Multipliers Mth Modeling Lecture 4: Lgrnge Multipliers Pge 4452 Mthemticl Modeling Lecture 4: Lgrnge Multipliers Lgrnge multipliers re high powered mthemticl technique to find the mximum nd minimum of multidimensionl

More information

Unit #9 : Definite Integral Properties, Fundamental Theorem of Calculus

Unit #9 : Definite Integral Properties, Fundamental Theorem of Calculus Unit #9 : Definite Integrl Properties, Fundmentl Theorem of Clculus Gols: Identify properties of definite integrls Define odd nd even functions, nd reltionship to integrl vlues Introduce the Fundmentl

More information

1. SEQUENCES INVOLVING EXPONENTIAL GROWTH (GEOMETRIC SEQUENCES)

1. SEQUENCES INVOLVING EXPONENTIAL GROWTH (GEOMETRIC SEQUENCES) Numbers nd Opertions, Algebr, nd Functions 45. SEQUENCES INVOLVING EXPONENTIAL GROWTH (GEOMETRIC SEQUENCES) In sequence of terms involving eponentil growth, which the testing service lso clls geometric

More information

MA1008. Calculus and Linear Algebra for Engineers. Course Notes for Section B. Stephen Wills. Department of Mathematics. University College Cork

MA1008. Calculus and Linear Algebra for Engineers. Course Notes for Section B. Stephen Wills. Department of Mathematics. University College Cork MA1008 Clculus nd Liner Algebr for Engineers Course Notes for Section B Stephen Wills Deprtment of Mthemtics University College Cork s.wills@ucc.ie http://euclid.ucc.ie/pges/stff/wills/teching/m1008/ma1008.html

More information

10.5 Graphing Quadratic Functions

10.5 Graphing Quadratic Functions 0.5 Grphing Qudrtic Functions Now tht we cn solve qudrtic equtions, we wnt to lern how to grph the function ssocited with the qudrtic eqution. We cll this the qudrtic function. Grphs of Qudrtic Functions

More information

Definition of Regular Expression

Definition of Regular Expression Definition of Regulr Expression After the definition of the string nd lnguges, we re redy to descrie regulr expressions, the nottion we shll use to define the clss of lnguges known s regulr sets. Recll

More information

CPSC 213. Polymorphism. Introduction to Computer Systems. Readings for Next Two Lectures. Back to Procedure Calls

CPSC 213. Polymorphism. Introduction to Computer Systems. Readings for Next Two Lectures. Back to Procedure Calls Redings for Next Two Lectures Text CPSC 213 Switch Sttements, Understnding Pointers - 2nd ed: 3.6.7, 3.10-1st ed: 3.6.6, 3.11 Introduction to Computer Systems Unit 1f Dynmic Control Flow Polymorphism nd

More information

Lists in Lisp and Scheme

Lists in Lisp and Scheme Lists in Lisp nd Scheme Lists in Lisp nd Scheme Lists re Lisp s fundmentl dt structures, ut there re others Arrys, chrcters, strings, etc. Common Lisp hs moved on from eing merely LISt Processor However,

More information

Lecture 10 Evolutionary Computation: Evolution strategies and genetic programming

Lecture 10 Evolutionary Computation: Evolution strategies and genetic programming Lecture 10 Evolutionry Computtion: Evolution strtegies nd genetic progrmming Evolution strtegies Genetic progrmming Summry Negnevitsky, Person Eduction, 2011 1 Evolution Strtegies Another pproch to simulting

More information

Fall 2017 Midterm Exam 1 October 19, You may not use any books, notes, or electronic devices during this exam.

Fall 2017 Midterm Exam 1 October 19, You may not use any books, notes, or electronic devices during this exam. 15-112 Fll 2017 Midterm Exm 1 October 19, 2017 Nme: Andrew ID: Recittion Section: You my not use ny books, notes, or electronic devices during this exm. You my not sk questions bout the exm except for

More information

MATH 25 CLASS 5 NOTES, SEP

MATH 25 CLASS 5 NOTES, SEP MATH 25 CLASS 5 NOTES, SEP 30 2011 Contents 1. A brief diversion: reltively prime numbers 1 2. Lest common multiples 3 3. Finding ll solutions to x + by = c 4 Quick links to definitions/theorems Euclid

More information

COMMON HALF YEARLY EXAMINATION DECEMBER 2018

COMMON HALF YEARLY EXAMINATION DECEMBER 2018 li.net i.net li.net i.net li.net i.net li.net i.net li.net i.net li.net i.net li.net i.net li.net i.net li.net i.net.pds.pds COMMON HALF YEARLY EXAMINATION DECEMBER 2018 STD : XI SUBJECT: COMPUTER SCIENCE

More information

Fall 2018 Midterm 1 October 11, ˆ You may not ask questions about the exam except for language clarifications.

Fall 2018 Midterm 1 October 11, ˆ You may not ask questions about the exam except for language clarifications. 15-112 Fll 2018 Midterm 1 October 11, 2018 Nme: Andrew ID: Recittion Section: ˆ You my not use ny books, notes, extr pper, or electronic devices during this exm. There should be nothing on your desk or

More information

2 Computing all Intersections of a Set of Segments Line Segment Intersection

2 Computing all Intersections of a Set of Segments Line Segment Intersection 15-451/651: Design & Anlysis of Algorithms Novemer 14, 2016 Lecture #21 Sweep-Line nd Segment Intersection lst chnged: Novemer 8, 2017 1 Preliminries The sweep-line prdigm is very powerful lgorithmic design

More information

In the last lecture, we discussed how valid tokens may be specified by regular expressions.

In the last lecture, we discussed how valid tokens may be specified by regular expressions. LECTURE 5 Scnning SYNTAX ANALYSIS We know from our previous lectures tht the process of verifying the syntx of the progrm is performed in two stges: Scnning: Identifying nd verifying tokens in progrm.

More information

PYTHON PROGRAMMING. The History of Python. Features of Python. This Course

PYTHON PROGRAMMING. The History of Python. Features of Python. This Course The History of Python PYTHON PROGRAMMING Dr Christin Hill 7 9 November 2016 Invented by Guido vn Rossum* t the Centrum Wiskunde & Informtic in Amsterdm in the erly 1990s Nmed fter Monty Python s Flying

More information

such that the S i cover S, or equivalently S

such that the S i cover S, or equivalently S MATH 55 Triple Integrls Fll 16 1. Definition Given solid in spce, prtition of consists of finite set of solis = { 1,, n } such tht the i cover, or equivlently n i. Furthermore, for ech i, intersects i

More information

Strings. Chapter 6. Python for Informatics: Exploring Information

Strings. Chapter 6. Python for Informatics: Exploring Information Strings Chpter 6 Python for Informtics: Exploring Informtion www.pythonlern.com String Dt Type A string is sequence of chrcters A string literl uses quotes 'Hello' or "Hello" For strings, + mens conctente

More information

COMPUTER SCIENCE 123. Foundations of Computer Science. 6. Tuples

COMPUTER SCIENCE 123. Foundations of Computer Science. 6. Tuples COMPUTER SCIENCE 123 Foundtions of Computer Science 6. Tuples Summry: This lecture introduces tuples in Hskell. Reference: Thompson Sections 5.1 2 R.L. While, 2000 3 Tuples Most dt comes with structure

More information

box Boxes and Arrows 3 true 7.59 'X' An object is drawn as a box that contains its data members, for example:

box Boxes and Arrows 3 true 7.59 'X' An object is drawn as a box that contains its data members, for example: Boxes nd Arrows There re two kinds of vriles in Jv: those tht store primitive vlues nd those tht store references. Primitive vlues re vlues of type long, int, short, chr, yte, oolen, doule, nd flot. References

More information

a(e, x) = x. Diagrammatically, this is encoded as the following commutative diagrams / X

a(e, x) = x. Diagrammatically, this is encoded as the following commutative diagrams / X 4. Mon, Sept. 30 Lst time, we defined the quotient topology coming from continuous surjection q : X! Y. Recll tht q is quotient mp (nd Y hs the quotient topology) if V Y is open precisely when q (V ) X

More information

9 4. CISC - Curriculum & Instruction Steering Committee. California County Superintendents Educational Services Association

9 4. CISC - Curriculum & Instruction Steering Committee. California County Superintendents Educational Services Association 9. CISC - Curriculum & Instruction Steering Committee The Winning EQUATION A HIGH QUALITY MATHEMATICS PROFESSIONAL DEVELOPMENT PROGRAM FOR TEACHERS IN GRADES THROUGH ALGEBRA II STRAND: NUMBER SENSE: Rtionl

More information

A Tautology Checker loosely related to Stålmarck s Algorithm by Martin Richards

A Tautology Checker loosely related to Stålmarck s Algorithm by Martin Richards A Tutology Checker loosely relted to Stålmrck s Algorithm y Mrtin Richrds mr@cl.cm.c.uk http://www.cl.cm.c.uk/users/mr/ University Computer Lortory New Museum Site Pemroke Street Cmridge, CB2 3QG Mrtin

More information

INTRODUCTION TO SIMPLICIAL COMPLEXES

INTRODUCTION TO SIMPLICIAL COMPLEXES INTRODUCTION TO SIMPLICIAL COMPLEXES CASEY KELLEHER AND ALESSANDRA PANTANO 0.1. Introduction. In this ctivity set we re going to introduce notion from Algebric Topology clled simplicil homology. The min

More information

Geometric transformations

Geometric transformations Geometric trnsformtions Computer Grphics Some slides re bsed on Shy Shlom slides from TAU mn n n m m T A,,,,,, 2 1 2 22 12 1 21 11 Rows become columns nd columns become rows nm n n m m A,,,,,, 1 1 2 22

More information

Fall 2018 Midterm 2 November 15, 2018

Fall 2018 Midterm 2 November 15, 2018 Nme: 15-112 Fll 2018 Midterm 2 November 15, 2018 Andrew ID: Recittion Section: ˆ You my not use ny books, notes, extr pper, or electronic devices during this exm. There should be nothing on your desk or

More information

Unit 5 Vocabulary. A function is a special relationship where each input has a single output.

Unit 5 Vocabulary. A function is a special relationship where each input has a single output. MODULE 3 Terms Definition Picture/Exmple/Nottion 1 Function Nottion Function nottion is n efficient nd effective wy to write functions of ll types. This nottion llows you to identify the input vlue with

More information

cisc1110 fall 2010 lecture VI.2 call by value function parameters another call by value example:

cisc1110 fall 2010 lecture VI.2 call by value function parameters another call by value example: cisc1110 fll 2010 lecture VI.2 cll y vlue function prmeters more on functions more on cll y vlue nd cll y reference pssing strings to functions returning strings from functions vrile scope glol vriles

More information

6.2 Volumes of Revolution: The Disk Method

6.2 Volumes of Revolution: The Disk Method mth ppliction: volumes by disks: volume prt ii 6 6 Volumes of Revolution: The Disk Method One of the simplest pplictions of integrtion (Theorem 6) nd the ccumultion process is to determine so-clled volumes

More information

Slides for Data Mining by I. H. Witten and E. Frank

Slides for Data Mining by I. H. Witten and E. Frank Slides for Dt Mining y I. H. Witten nd E. Frnk Simplicity first Simple lgorithms often work very well! There re mny kinds of simple structure, eg: One ttriute does ll the work All ttriutes contriute eqully

More information

12-B FRACTIONS AND DECIMALS

12-B FRACTIONS AND DECIMALS -B Frctions nd Decimls. () If ll four integers were negtive, their product would be positive, nd so could not equl one of them. If ll four integers were positive, their product would be much greter thn

More information

UNIT 11. Query Optimization

UNIT 11. Query Optimization UNIT Query Optimiztion Contents Introduction to Query Optimiztion 2 The Optimiztion Process: An Overview 3 Optimiztion in System R 4 Optimiztion in INGRES 5 Implementing the Join Opertors Wei-Png Yng,

More information

5 Regular 4-Sided Composition

5 Regular 4-Sided Composition Xilinx-Lv User Guide 5 Regulr 4-Sided Composition This tutoril shows how regulr circuits with 4-sided elements cn be described in Lv. The type of regulr circuits tht re discussed in this tutoril re those

More information

Improper Integrals. October 4, 2017

Improper Integrals. October 4, 2017 Improper Integrls October 4, 7 Introduction We hve seen how to clculte definite integrl when the it is rel number. However, there re times when we re interested to compute the integrl sy for emple 3. Here

More information

Systems I. Logic Design I. Topics Digital logic Logic gates Simple combinational logic circuits

Systems I. Logic Design I. Topics Digital logic Logic gates Simple combinational logic circuits Systems I Logic Design I Topics Digitl logic Logic gtes Simple comintionl logic circuits Simple C sttement.. C = + ; Wht pieces of hrdwre do you think you might need? Storge - for vlues,, C Computtion

More information

ΕΠΛ323 - Θεωρία και Πρακτική Μεταγλωττιστών

ΕΠΛ323 - Θεωρία και Πρακτική Μεταγλωττιστών ΕΠΛ323 - Θωρία και Πρακτική Μταγλωττιστών Lecture 3 Lexicl Anlysis Elis Athnsopoulos elisthn@cs.ucy.c.cy Recognition of Tokens if expressions nd reltionl opertors if è if then è then else è else relop

More information

Data sharing in OpenMP

Data sharing in OpenMP Dt shring in OpenMP Polo Burgio polo.burgio@unimore.it Outline Expressing prllelism Understnding prllel threds Memory Dt mngement Dt cluses Synchroniztion Brriers, locks, criticl sections Work prtitioning

More information

Agenda & Reading. Class Exercise. COMPSCI 105 SS 2012 Principles of Computer Science. Arrays

Agenda & Reading. Class Exercise. COMPSCI 105 SS 2012 Principles of Computer Science. Arrays COMPSCI 5 SS Principles of Computer Science Arrys & Multidimensionl Arrys Agend & Reding Agend Arrys Creting & Using Primitive & Reference Types Assignments & Equlity Pss y Vlue & Pss y Reference Copying

More information

What do all those bits mean now? Number Systems and Arithmetic. Introduction to Binary Numbers. Questions About Numbers

What do all those bits mean now? Number Systems and Arithmetic. Introduction to Binary Numbers. Questions About Numbers Wht do ll those bits men now? bits (...) Number Systems nd Arithmetic or Computers go to elementry school instruction R-formt I-formt... integer dt number text chrs... floting point signed unsigned single

More information

Reducing a DFA to a Minimal DFA

Reducing a DFA to a Minimal DFA Lexicl Anlysis - Prt 4 Reducing DFA to Miniml DFA Input: DFA IN Assume DFA IN never gets stuck (dd ded stte if necessry) Output: DFA MIN An equivlent DFA with the minimum numer of sttes. Hrry H. Porter,

More information

Digital Design. Chapter 6: Optimizations and Tradeoffs

Digital Design. Chapter 6: Optimizations and Tradeoffs Digitl Design Chpter 6: Optimiztions nd Trdeoffs Slides to ccompny the tetbook Digitl Design, with RTL Design, VHDL, nd Verilog, 2nd Edition, by Frnk Vhid, John Wiley nd Sons Publishers, 2. http://www.ddvhid.com

More information

Section 3.1: Sequences and Series

Section 3.1: Sequences and Series Section.: Sequences d Series Sequences Let s strt out with the definition of sequence: sequence: ordered list of numbers, often with definite pttern Recll tht in set, order doesn t mtter so this is one

More information

Stack. A list whose end points are pointed by top and bottom

Stack. A list whose end points are pointed by top and bottom 4. Stck Stck A list whose end points re pointed by top nd bottom Insertion nd deletion tke plce t the top (cf: Wht is the difference between Stck nd Arry?) Bottom is constnt, but top grows nd shrinks!

More information

Pointers and Arrays. More Pointer Examples. Pointers CS 217

Pointers and Arrays. More Pointer Examples. Pointers CS 217 Pointers nd Arrs CS 21 1 2 Pointers More Pointer Emples Wht is pointer A vrile whose vlue is the ddress of nother vrile p is pointer to vrile v Opertions &: ddress of (reference) *: indirection (dereference)

More information

How to Design REST API? Written Date : March 23, 2015

How to Design REST API? Written Date : March 23, 2015 Visul Prdigm How Design REST API? Turil How Design REST API? Written Dte : Mrch 23, 2015 REpresenttionl Stte Trnsfer, n rchitecturl style tht cn be used in building networked pplictions, is becoming incresingly

More information

Questions About Numbers. Number Systems and Arithmetic. Introduction to Binary Numbers. Negative Numbers?

Questions About Numbers. Number Systems and Arithmetic. Introduction to Binary Numbers. Negative Numbers? Questions About Numbers Number Systems nd Arithmetic or Computers go to elementry school How do you represent negtive numbers? frctions? relly lrge numbers? relly smll numbers? How do you do rithmetic?

More information

Midterm 2 Sample solution

Midterm 2 Sample solution Nme: Instructions Midterm 2 Smple solution CMSC 430 Introduction to Compilers Fll 2012 November 28, 2012 This exm contins 9 pges, including this one. Mke sure you hve ll the pges. Write your nme on the

More information

Misrepresentation of Preferences

Misrepresentation of Preferences Misrepresenttion of Preferences Gicomo Bonnno Deprtment of Economics, University of Cliforni, Dvis, USA gfbonnno@ucdvis.edu Socil choice functions Arrow s theorem sys tht it is not possible to extrct from

More information

OUTPUT DELIVERY SYSTEM

OUTPUT DELIVERY SYSTEM Differences in ODS formtting for HTML with Proc Print nd Proc Report Lur L. M. Thornton, USDA-ARS, Animl Improvement Progrms Lortory, Beltsville, MD ABSTRACT While Proc Print is terrific tool for dt checking

More information

Mid-term exam. Scores. Fall term 2012 KAIST EE209 Programming Structures for EE. Thursday Oct 25, Student's name: Student ID:

Mid-term exam. Scores. Fall term 2012 KAIST EE209 Programming Structures for EE. Thursday Oct 25, Student's name: Student ID: Fll term 2012 KAIST EE209 Progrmming Structures for EE Mid-term exm Thursdy Oct 25, 2012 Student's nme: Student ID: The exm is closed book nd notes. Red the questions crefully nd focus your nswers on wht

More information

SIMPLIFYING ALGEBRA PASSPORT.

SIMPLIFYING ALGEBRA PASSPORT. SIMPLIFYING ALGEBRA PASSPORT www.mthletics.com.u This booklet is ll bout turning complex problems into something simple. You will be ble to do something like this! ( 9- # + 4 ' ) ' ( 9- + 7-) ' ' Give

More information

MATLAB Session for CS4514

MATLAB Session for CS4514 MATLAB Session for CS4514 Adrin Her her @wpi.edu Computing & Communictions Center - November 28, 2006- Prt of the notes re from Mtlb documenttion 1 MATLAB Session for CS4514 1. Mtlb Bsics Strting Mtlb

More information

If you are at the university, either physically or via the VPN, you can download the chapters of this book as PDFs.

If you are at the university, either physically or via the VPN, you can download the chapters of this book as PDFs. Lecture 5 Wlks, Trils, Pths nd Connectedness Reding: Some of the mteril in this lecture comes from Section 1.2 of Dieter Jungnickel (2008), Grphs, Networks nd Algorithms, 3rd edition, which is ville online

More information

x )Scales are the reciprocal of each other. e

x )Scales are the reciprocal of each other. e 9. Reciprocls A Complete Slide Rule Mnul - eville W Young Chpter 9 Further Applictions of the LL scles The LL (e x ) scles nd the corresponding LL 0 (e -x or Exmple : 0.244 4.. Set the hir line over 4.

More information

Dynamic Programming. Andreas Klappenecker. [partially based on slides by Prof. Welch] Monday, September 24, 2012

Dynamic Programming. Andreas Klappenecker. [partially based on slides by Prof. Welch] Monday, September 24, 2012 Dynmic Progrmming Andres Klppenecker [prtilly bsed on slides by Prof. Welch] 1 Dynmic Progrmming Optiml substructure An optiml solution to the problem contins within it optiml solutions to subproblems.

More information

CSCI 3130: Formal Languages and Automata Theory Lecture 12 The Chinese University of Hong Kong, Fall 2011

CSCI 3130: Formal Languages and Automata Theory Lecture 12 The Chinese University of Hong Kong, Fall 2011 CSCI 3130: Forml Lnguges nd utomt Theory Lecture 12 The Chinese University of Hong Kong, Fll 2011 ndrej Bogdnov In progrmming lnguges, uilding prse trees is significnt tsk ecuse prse trees tell us the

More information

MIPS I/O and Interrupt

MIPS I/O and Interrupt MIPS I/O nd Interrupt Review Floting point instructions re crried out on seprte chip clled coprocessor 1 You hve to move dt to/from coprocessor 1 to do most common opertions such s printing, clling functions,

More information

Solutions to Math 41 Final Exam December 12, 2011

Solutions to Math 41 Final Exam December 12, 2011 Solutions to Mth Finl Em December,. ( points) Find ech of the following its, with justifiction. If there is n infinite it, then eplin whether it is or. ( ) / ln() () (5 points) First we compute the it:

More information

Section 10.4 Hyperbolas

Section 10.4 Hyperbolas 66 Section 10.4 Hyperbols Objective : Definition of hyperbol & hyperbols centered t (0, 0). The third type of conic we will study is the hyperbol. It is defined in the sme mnner tht we defined the prbol

More information

2014 Haskell January Test Regular Expressions and Finite Automata

2014 Haskell January Test Regular Expressions and Finite Automata 0 Hskell Jnury Test Regulr Expressions nd Finite Automt This test comprises four prts nd the mximum mrk is 5. Prts I, II nd III re worth 3 of the 5 mrks vilble. The 0 Hskell Progrmming Prize will be wrded

More information

Introduction to Julia for Bioinformatics

Introduction to Julia for Bioinformatics Introduction to Juli for Bioinformtics This introduction ssumes tht you hve bsic knowledge of some scripting lnguge nd provides n exmple of the Juli syntx. Continuous Assessment Problems In this course

More information

Theory of Computation CSE 105

Theory of Computation CSE 105 $ $ $ Theory of Computtion CSE 105 Regulr Lnguges Study Guide nd Homework I Homework I: Solutions to the following problems should be turned in clss on July 1, 1999. Instructions: Write your nswers clerly

More information

COMP 423 lecture 11 Jan. 28, 2008

COMP 423 lecture 11 Jan. 28, 2008 COMP 423 lecture 11 Jn. 28, 2008 Up to now, we hve looked t how some symols in n lphet occur more frequently thn others nd how we cn sve its y using code such tht the codewords for more frequently occuring

More information

George Boole. IT 3123 Hardware and Software Concepts. Switching Algebra. Boolean Functions. Boolean Functions. Truth Tables

George Boole. IT 3123 Hardware and Software Concepts. Switching Algebra. Boolean Functions. Boolean Functions. Truth Tables George Boole IT 3123 Hrdwre nd Softwre Concepts My 28 Digitl Logic The Little Mn Computer 1815 1864 British mthemticin nd philosopher Mny contriutions to mthemtics. Boolen lger: n lger over finite sets

More information

Lecture Overview. Knowledge-based systems in Bioinformatics, 1MB602. Procedural abstraction. The sum procedure. Integration as a procedure

Lecture Overview. Knowledge-based systems in Bioinformatics, 1MB602. Procedural abstraction. The sum procedure. Integration as a procedure Lecture Overview Knowledge-bsed systems in Bioinformtics, MB6 Scheme lecture Procedurl bstrction Higher order procedures Procedures s rguments Procedures s returned vlues Locl vribles Dt bstrction Compound

More information

Fig.25: the Role of LEX

Fig.25: the Role of LEX The Lnguge for Specifying Lexicl Anlyzer We shll now study how to uild lexicl nlyzer from specifiction of tokens in the form of list of regulr expressions The discussion centers round the design of n existing

More information

Example: 2:1 Multiplexer

Example: 2:1 Multiplexer Exmple: 2:1 Multiplexer Exmple #1 reg ; lwys @( or or s) egin if (s == 1') egin = ; else egin = ; 1 s B. Bs 114 Exmple: 2:1 Multiplexer Exmple #2 Normlly lwys include egin nd sttements even though they

More information

Reducing Costs with Duck Typing. Structural

Reducing Costs with Duck Typing. Structural Reducing Costs with Duck Typing Structurl 1 Duck Typing In computer progrmming with object-oriented progrmming lnguges, duck typing is lyer of progrmming lnguge nd design rules on top of typing. Typing

More information

Dr. D.M. Akbar Hussain

Dr. D.M. Akbar Hussain Dr. D.M. Akr Hussin Lexicl Anlysis. Bsic Ide: Red the source code nd generte tokens, it is similr wht humns will do to red in; just tking on the input nd reking it down in pieces. Ech token is sequence

More information

Math 142, Exam 1 Information.

Math 142, Exam 1 Information. Mth 14, Exm 1 Informtion. 9/14/10, LC 41, 9:30-10:45. Exm 1 will be bsed on: Sections 7.1-7.5. The corresponding ssigned homework problems (see http://www.mth.sc.edu/ boyln/sccourses/14f10/14.html) At

More information

fraction arithmetic. For example, consider this problem the 1995 TIMSS Trends in International Mathematics and Science Study:

fraction arithmetic. For example, consider this problem the 1995 TIMSS Trends in International Mathematics and Science Study: Brringer Fll Mth Cmp November, 06 Introduction In recent yers, mthemtics eductors hve begun to relize tht understnding frctions nd frctionl rithmetic is the gtewy to dvnced high school mthemtics Yet, US

More information

Agilent Mass Hunter Software

Agilent Mass Hunter Software Agilent Mss Hunter Softwre Quick Strt Guide Use this guide to get strted with the Mss Hunter softwre. Wht is Mss Hunter Softwre? Mss Hunter is n integrl prt of Agilent TOF softwre (version A.02.00). Mss

More information

Small Business Networking

Small Business Networking Why network is n essentil productivity tool for ny smll business Effective technology is essentil for smll businesses looking to increse the productivity of their people nd business. Introducing technology

More information

Before We Begin. Introduction to Spatial Domain Filtering. Introduction to Digital Image Processing. Overview (1): Administrative Details (1):

Before We Begin. Introduction to Spatial Domain Filtering. Introduction to Digital Image Processing. Overview (1): Administrative Details (1): Overview (): Before We Begin Administrtive detils Review some questions to consider Winter 2006 Imge Enhncement in the Sptil Domin: Bsics of Sptil Filtering, Smoothing Sptil Filters, Order Sttistics Filters

More information

CSE 401 Midterm Exam 11/5/10 Sample Solution

CSE 401 Midterm Exam 11/5/10 Sample Solution Question 1. egulr expressions (20 points) In the Ad Progrmming lnguge n integer constnt contins one or more digits, but it my lso contin embedded underscores. Any underscores must be preceded nd followed

More information

Basics of Logic Design Arithmetic Logic Unit (ALU)

Basics of Logic Design Arithmetic Logic Unit (ALU) Bsics of Logic Design Arithmetic Logic Unit (ALU) CPS 4 Lecture 9 Tody s Lecture Homework #3 Assigned Due Mrch 3 Project Groups ssigned & posted to lckord. Project Specifiction is on We Due April 9 Building

More information

Lexical Analysis. Amitabha Sanyal. (www.cse.iitb.ac.in/ as) Department of Computer Science and Engineering, Indian Institute of Technology, Bombay

Lexical Analysis. Amitabha Sanyal. (www.cse.iitb.ac.in/ as) Department of Computer Science and Engineering, Indian Institute of Technology, Bombay Lexicl Anlysis Amith Snyl (www.cse.iit.c.in/ s) Deprtment of Computer Science nd Engineering, Indin Institute of Technology, Bomy Septemer 27 College of Engineering, Pune Lexicl Anlysis: 2/6 Recp The input

More information

From Dependencies to Evaluation Strategies

From Dependencies to Evaluation Strategies From Dependencies to Evlution Strtegies Possile strtegies: 1 let the user define the evlution order 2 utomtic strtegy sed on the dependencies: use locl dependencies to determine which ttriutes to compute

More information

Subtracting Fractions

Subtracting Fractions Lerning Enhncement Tem Model Answers: Adding nd Subtrcting Frctions Adding nd Subtrcting Frctions study guide. When the frctions both hve the sme denomintor (bottom) you cn do them using just simple dding

More information

Engineer To Engineer Note

Engineer To Engineer Note Engineer To Engineer Note EE-188 Technicl Notes on using Anlog Devices' DSP components nd development tools Contct our technicl support by phone: (800) ANALOG-D or e-mil: dsp.support@nlog.com Or visit

More information

Matrices and Systems of Equations

Matrices and Systems of Equations Mtrices Mtrices nd Sstems of Equtions A mtri is rectngulr rr of rel numbers. CHAT Pre-Clculus Section 8. m m m............ n n n mn We will use the double subscript nottion for ech element of the mtri.

More information

Suffix trees, suffix arrays, BWT

Suffix trees, suffix arrays, BWT ALGORITHMES POUR LA BIO-INFORMATIQUE ET LA VISUALISATION COURS 3 Rluc Uricru Suffix trees, suffix rrys, BWT Bsed on: Suffix trees nd suffix rrys presenttion y Him Kpln Suffix trees course y Pco Gomez Liner-Time

More information

The Fundamental Theorem of Calculus

The Fundamental Theorem of Calculus MATH 6 The Fundmentl Theorem of Clculus The Fundmentl Theorem of Clculus (FTC) gives method of finding the signed re etween the grph of f nd the x-xis on the intervl [, ]. The theorem is: FTC: If f is

More information

EECS 281: Homework #4 Due: Thursday, October 7, 2004

EECS 281: Homework #4 Due: Thursday, October 7, 2004 EECS 28: Homework #4 Due: Thursdy, October 7, 24 Nme: Emil:. Convert the 24-bit number x44243 to mime bse64: QUJD First, set is to brek 8-bit blocks into 6-bit blocks, nd then convert: x44243 b b 6 2 9

More information

1 Quad-Edge Construction Operators

1 Quad-Edge Construction Operators CS48: Computer Grphics Hndout # Geometric Modeling Originl Hndout #5 Stnford University Tuesdy, 8 December 99 Originl Lecture #5: 9 November 99 Topics: Mnipultions with Qud-Edge Dt Structures Scribe: Mike

More information

Today s Lecture. Basics of Logic Design: Boolean Algebra, Logic Gates. Recursive Example. Review: The C / C++ code. Recursive Example (Continued)

Today s Lecture. Basics of Logic Design: Boolean Algebra, Logic Gates. Recursive Example. Review: The C / C++ code. Recursive Example (Continued) Tod s Lecture Bsics of Logic Design: Boolen Alger, Logic Gtes Alvin R. Leeck CPS 4 Lecture 8 Homework #2 Due Ferur 3 Outline Review (sseml recursion) Building the uilding locks Logic Design Truth tles,

More information

Introduction to Computer Engineering EECS 203 dickrp/eecs203/ CMOS transmission gate (TG) TG example

Introduction to Computer Engineering EECS 203  dickrp/eecs203/ CMOS transmission gate (TG) TG example Introduction to Computer Engineering EECS 23 http://ziyng.eecs.northwestern.edu/ dickrp/eecs23/ CMOS trnsmission gte TG Instructor: Robert Dick Office: L477 Tech Emil: dickrp@northwestern.edu Phone: 847

More information

binary trees, expression trees

binary trees, expression trees COMP 250 Lecture 21 binry trees, expression trees Oct. 27, 2017 1 Binry tree: ech node hs t most two children. 2 Mximum number of nodes in binry tree? Height h (e.g. 3) 3 Mximum number of nodes in binry

More information

Math 464 Fall 2012 Notes on Marginal and Conditional Densities October 18, 2012

Math 464 Fall 2012 Notes on Marginal and Conditional Densities October 18, 2012 Mth 464 Fll 2012 Notes on Mrginl nd Conditionl Densities klin@mth.rizon.edu October 18, 2012 Mrginl densities. Suppose you hve 3 continuous rndom vribles X, Y, nd Z, with joint density f(x,y,z. The mrginl

More information

Homework. Context Free Languages III. Languages. Plan for today. Context Free Languages. CFLs and Regular Languages. Homework #5 (due 10/22)

Homework. Context Free Languages III. Languages. Plan for today. Context Free Languages. CFLs and Regular Languages. Homework #5 (due 10/22) Homework Context Free Lnguges III Prse Trees nd Homework #5 (due 10/22) From textbook 6.4,b 6.5b 6.9b,c 6.13 6.22 Pln for tody Context Free Lnguges Next clss of lnguges in our quest! Lnguges Recll. Wht

More information

Presentation Martin Randers

Presentation Martin Randers Presenttion Mrtin Rnders Outline Introduction Algorithms Implementtion nd experiments Memory consumption Summry Introduction Introduction Evolution of species cn e modelled in trees Trees consist of nodes

More information

ΕΠΛ323 - Θεωρία και Πρακτική Μεταγλωττιστών. Lecture 3b Lexical Analysis Elias Athanasopoulos

ΕΠΛ323 - Θεωρία και Πρακτική Μεταγλωττιστών. Lecture 3b Lexical Analysis Elias Athanasopoulos ΕΠΛ323 - Θωρία και Πρακτική Μταγλωττιστών Lecture 3 Lexicl Anlysis Elis Athnsopoulos elisthn@cs.ucy.c.cy RecogniNon of Tokens if expressions nd relnonl opertors if è if then è then else è else relop è

More information

Small Business Networking

Small Business Networking Why network is n essentil productivity tool for ny smll business Effective technology is essentil for smll businesses looking to increse the productivity of their people nd processes. Introducing technology

More information

9.1 apply the distance and midpoint formulas

9.1 apply the distance and midpoint formulas 9.1 pply the distnce nd midpoint formuls DISTANCE FORMULA MIDPOINT FORMULA To find the midpoint between two points x, y nd x y 1 1,, we Exmple 1: Find the distnce between the two points. Then, find the

More information