CISC 320 Introduction to Algorithms Spring 2014

Size: px
Start display at page:

Download "CISC 320 Introduction to Algorithms Spring 2014"

Transcription

1 CISC 20 Introdution to Algorithms Spring 2014 Leture 9 Red-Blk Trees Courtes of Prof. Lio Li 1

2 Binr Serh Trees (BST) ke[x]: ke stored t x. left[x]: pointer to left hild of x. right[x]: pointer to right hild of x. p[x]: pointer to prent node of x. inr-serh-tree propert: for ever node x: ke[] ke[x] ke[z] where is n node in the left sutree of x, nd z is n node in the right sutree of x. e.g., two vlid BSTs for the kes 2,, 4,,,

3 Inorder-tree-wlk(x) 1. if x nil 2. then inorder-tree-wlk(left[x]);. print ke[x]; 4. inorder-tree-wlk(right[x]); It prints ll elements in monotonill inresing order, in Θ(n) time. BST Serh Serh(T, k) 1. x = root[t]; 2. if x = nil or k = ke[x]. then return x; 4. if k < ke[x]. then return Serh(left[x], k) 6. else return Serh(right[x], k);

4 z () () ()

5 Time: O(h), where h is the tree height. for lned inr tree, h = lg(n) worst-se: h = n

6 Rottion Left rotte x Right rotte x Note: 1. inorder ke ordering is unhnged fter rottion:, x,,, 2. rottion tkes O(1) time. 6

7 Left rotte

8 Left-rotte(T,x) 1. right[x] 2. right[x] left[]. if left[] nil 4. then p[left[]] x. p[] p[x] 6. if p[x] = nil. then root[t] 8. else if x = left[p[x]] 9. then left[p[x]] 10. else right[p[x]] 11. left[] x 12. p[x] x Left rotte x 8

9 Is there mehnism to utomtill rotte whenever the tree is signifintl unlned? 9

10 Red- Blk Trees Red-lk tree is inr serh tree Ever node is either red or lk. Root nd leves (nil) re lk If node is red, then oth hildren re lk All pths from n node x to desendnt lef hve sme numer of lk nodes. Definition: lk-height of node x is the numer of lk nodes (exluding x) on n pth from x to desendnt lef. 10

11 A red-lk tree 12 Intuition: if red-lk tree ontins lk nodes onl, the tree is perfetl lned, i.e., it is omplete inr tree. Presene of red nodes orrupts the lne, ut not muh, euse of the restritions imposed on red nodes. 11

12 Theorem 6. A red-lk tree with n internl nodes hs height t most 2 lg(n+1). proof: ) for n node x, its lk-height denoted s h(x), there re t lest 2 h(x) 1 internl nodes under x (proof indution). ) if the root r hs height h, then h 2 h(r), euse t lest hlf of the nodes on n pth from r to lef must e lk. Aording to ), we hve 2 h(r) 1 n h(r) lg (n+1) h 2 lg(n+1). QED 12

13 Therefore, red-lk tree n never e too off- lned. As result, serhing ke in red-lk tree of n nodes tkes O(2 lg(n+1)) time. How out insert nd delete? More work is needed for these opertions sine the red-lk tree properties need to e mintined. 1

14 Insertion step 1: lote where to insert, vi n unsuessful serh. O(lg n) step 2: insert. O(1) new node is ssigned red olor. wh? - n new node potentill n unlne the tree - if red node gets red hild, RBT is roken. This lerts us to prevent from ontinuousl dding nodes t rnh. - hrd rgument: otherwise the lk-height of the tree is not onserved. step : hek if red-lk-tree properties re dmged. If es, fix it rottions. O(?) 14

15 RB-Insert(T, z) 1. nil[t] 2. x root[t]. while x nil[t] 4. do x. if ke[z] < ke[x] 6. then x left[x]. else x right[x] 8. p[z] 9. If = nil[t] 10. then root[t] z 11. else if ke[z] < ke[] 12. then left[] z 1. else right[] z 14. left[z] nil[t]. right[z] nil[t]. Color[z] RED 1. RB-Insert-Fixup(T, z)

16 Cse 1: red unle E C new z C z A B d D e A B d D e 1. Wh C must e lk? 2. Wh C hs to e red fter B nd D re hnged to lk?. If C is not root, wht shll we do? if C is the root, wht shll we do?

17 Cse 1: red unle C new z C B d D e B d D e A z A 1

18 Cse 2: right hild, lk unle C C d d B A A z z B Does the rottion hnge the lk-height for ffeted pths?? 18

19 Cse : left hild, lk unle C B B d z A C d A z 1. Does this opertion hnge the lkheight for ll ffeted pths? 2. Will it propgte further up? 19

20 Cse 1 Cse Cse 2 z z z z

21 Cse 4, nd 6 re just mirror smmetri to ses 1, 2, nd respetivel, nd n e similrl hndled. 21

22 RB-Insert-Fixup(T, z) 1. while olor[p[z]] = RED 2. do if p[z] = left[p[p[z]]]. then right[p[p[z]]] 4. if olor[] = RED. then olor[p[z]] BLACK 6. olor[] BLACK. olor[p[p[z]]] RED 8. z p[p[z]] 9. else if z = right[p[z]] 10. then z p[z] 11. LEFT-ROTATE(T, z) 12. olor[p[z]] BLACK 1. olor[p[p[z]]] RED 14. RIGHT-ROTATE(T, p[p[z]]). else ( sme s then luse with right nd left exhnged). Color[root[T]] BLACK 22

23 Time nlsis for insertion RB-Insert-Fixup either removes red edge onstnt time (ses 2, nd ) or propgtes red edge one level up (never down), t most to the root, whih is the worst se. As redlk tree of n internl nodes n not e higher thn O(lg n), RB-Insert-Fixup runs in O(lg n) time. Therefore, the totl time is T(n) = O(lg n) + O(lg n) = O(lg n) 2

Data Structures and and Algorithm Xiaoqing Zheng

Data Structures and and Algorithm Xiaoqing Zheng Data Structures and Algorithm Xiaoqing Zheng zhengxq@fudan.edu.cn Trees (max heap) 1 16 2 3 14 10 4 5 6 7 8 7 9 3 8 9 10 2 4 1 PARENT(i) return i /2 LEFT(i) return 2i RIGHT(i) return 2i +1 16 14 10 8 7

More information

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

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

More information

Welcome. Balanced search trees. Balanced Search Trees. Inge Li Gørtz

Welcome. Balanced search trees. Balanced Search Trees. Inge Li Gørtz Welome nge Li Gørt. everse tehing n isussion of exerises: 02110 nge Li Gørt 3 tehing ssistnts 8.00-9.15 Group work 9.15-9.45 isussions of your solutions in lss 10.00-11.15 Leture 11.15-11.45 Work on exerises

More information

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

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

More information

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

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

More information

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

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

More information

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

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

More information

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

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

More information

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

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

More information

8.3 THE HYPERBOLA OBJECTIVES

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

More information

SIMPLE NONLINEAR GRAPHS

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

More information

CS 360 Exam 2 Fall 2014 Name

CS 360 Exam 2 Fall 2014 Name CS 360 Exm 2 Fll 2014 Nme 1. The lsses shown elow efine singly-linke list n stk. Write three ifferent O(n)-time versions of the reverse_print metho s speifie elow. Eh version of the metho shoul output

More information

Global alignment. Genome Rearrangements Finding preserved genes. Lecture 18

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

More information

Balanced binary search trees

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

More information

Data Structures (INE2011)

Data Structures (INE2011) Dt Strutures (INE2011) Eletronis nd Communition Engineering Hnyng University Hewoon Nm Leture 7 INE2011 Dt Strutures 1 Binry Tree Trversl Mny inry tree opertions re done y perorming trversl o the inry

More information

Algorithm Design and Analysis

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

More information

Exercise sheet 6: Solutions

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

More information

The Shortest Path Problem Graph Algorithms - 3

The Shortest Path Problem Graph Algorithms - 3 Algorithm Deign nd Anli Vitor Admhik C - pring Leture Feb, Crnegie Mellon Univerit The hortet Pth Problem Grph Algorithm - The hortet Pth Problem Given poitivel weighted grph G with oure verte, find the

More information

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

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

More information

a) Read over steps (1)- (4) below and sketch the path of the cycle on a P V plot on the graph below. Label all appropriate points.

a) Read over steps (1)- (4) below and sketch the path of the cycle on a P V plot on the graph below. Label all appropriate points. Prole 3: Crnot Cyle of n Idel Gs In this prole, the strting pressure P nd volue of n idel gs in stte, re given he rtio R = / > of the volues of the sttes nd is given Finlly onstnt γ = 5/3 is given You

More information

Arrow s Impossibility Theorem

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

More information

Logarithms LOGARITHMS.

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

More information

Algorithm Design and Analysis

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

More information

Lecture 3. XML Into RDBMS. XML and Databases. Memory Representations. Memory Representations. Traversals and Pre/Post-Encoding. Memory Representations

Lecture 3. XML Into RDBMS. XML and Databases. Memory Representations. Memory Representations. Traversals and Pre/Post-Encoding. Memory Representations Leture XML into RDBMS XML n Dtses Sestin Mneth NICTA n UNSW Leture XML Into RDBMS CSE@UNSW -- Semester, 00 Memory Representtions Memory Representtions Fts DOM is esy to use, ut memory hevy. in-memory size

More information

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

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

More information

CS 573 Automata Theory and Formal Languages

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

More information

6. Suppose lim = constant> 0. Which of the following does not hold?

6. Suppose lim = constant> 0. Which of the following does not hold? CSE 0-00 Nme Test 00 points UTA Stuent ID # Multiple Choie Write your nswer to the LEFT of eh prolem 5 points eh The k lrgest numers in file of n numers n e foun using Θ(k) memory in Θ(n lg k) time using

More information

Spacetime and the Quantum World Questions Fall 2010

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

More information

MAT 403 NOTES 4. f + f =

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

More information

Tutorial Worksheet. 1. Find all solutions to the linear system by following the given steps. x + 2y + 3z = 2 2x + 3y + z = 4.

Tutorial Worksheet. 1. Find all solutions to the linear system by following the given steps. x + 2y + 3z = 2 2x + 3y + z = 4. Mth 5 Tutoril Week 1 - Jnury 1 1 Nme Setion Tutoril Worksheet 1. Find ll solutions to the liner system by following the given steps x + y + z = x + y + z = 4. y + z = Step 1. Write down the rgumented mtrix

More information

Polynomials. Polynomials. Curriculum Ready ACMNA:

Polynomials. Polynomials. Curriculum Ready ACMNA: Polynomils Polynomils Curriulum Redy ACMNA: 66 www.mthletis.om Polynomils POLYNOMIALS A polynomil is mthemtil expression with one vrile whose powers re neither negtive nor frtions. The power in eh expression

More information

Suffix Trays and Suffix Trists: Structures for Faster Text Indexing

Suffix Trays and Suffix Trists: Structures for Faster Text Indexing Suffix Trys nd Suffix Trists: Strutures for Fster Text Indexing Rihrd Cole Tsvi Kopelowitz Moshe Lewenstein rxiv:1311.1762v1 [s.ds] 7 Nov 2013 Astrt Suffix trees nd suffix rrys re two of the most widely

More information

The Ellipse. is larger than the other.

The Ellipse. is larger than the other. The Ellipse Appolonius of Perg (5 B.C.) disovered tht interseting right irulr one ll the w through with plne slnted ut is not perpendiulr to the is, the intersetion provides resulting urve (oni setion)

More information

CS 491G Combinatorial Optimization Lecture Notes

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

More information

Chapter 4 State-Space Planning

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

More information

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

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

More information

These slides are from 2014 and contain a semi-serious error at one point in the

These slides are from 2014 and contain a semi-serious error at one point in the Hello Internet! Hello Internet! These slides re rom 2014 nd ontin semi-serious error t one point in the These slides re rom 2014 nd ontin semi-serious error t one point in the presenttion. For more up-to-dte

More information

Thermodynamics. Question 1. Question 2. Question 3 3/10/2010. Practice Questions PV TR PV T R

Thermodynamics. Question 1. Question 2. Question 3 3/10/2010. Practice Questions PV TR PV T R /10/010 Question 1 1 mole of idel gs is rought to finl stte F y one of three proesses tht hve different initil sttes s shown in the figure. Wht is true for the temperture hnge etween initil nd finl sttes?

More information

set is not closed under matrix [ multiplication, ] and does not form a group.

set is not closed under matrix [ multiplication, ] and does not form a group. Prolem 2.3: Which of the following collections of 2 2 mtrices with rel entries form groups under [ mtrix ] multipliction? i) Those of the form for which c d 2 Answer: The set of such mtrices is not closed

More information

Data Structures and Algorithms CMPSC 465

Data Structures and Algorithms CMPSC 465 Dt Structures nd Algorithms CMPSC 465 LECTURE 10 Solving recurrences Mster theorem Adm Smith S. Rskhodnikov nd A. Smith; bsed on slides by E. Demine nd C. Leiserson Review questions Guess the solution

More information

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

The Knapsack Problem. COSC 3101A - Design and Analysis of Algorithms 9. Fractional Knapsack Problem. Fractional Knapsack Problem The Knpsck Prolem COSC A - Design nd Anlsis of Algorithms Knpsck Prolem Huffmn Codes Introduction to Grphs Mn of these slides re tken from Monic Nicolescu, Univ. of Nevd, Reno, monic@cs.unr.edu The - knpsck

More information

8 THREE PHASE A.C. CIRCUITS

8 THREE PHASE A.C. CIRCUITS 8 THREE PHSE.. IRUITS The signls in hpter 7 were sinusoidl lternting voltges nd urrents of the so-lled single se type. n emf of suh type n e esily generted y rotting single loop of ondutor (or single winding),

More information

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

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

More information

Area and Perimeter. Area and Perimeter. Solutions. Curriculum Ready.

Area and Perimeter. Area and Perimeter. Solutions. Curriculum Ready. Are n Perimeter Are n Perimeter Solutions Curriulum Rey www.mthletis.om How oes it work? Solutions Are n Perimeter Pge questions Are using unit squres Are = whole squres Are = 6 whole squres = units =

More information

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

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

More information

CS 240 Data Structures and Data Management. Module 4: Dictionaries

CS 240 Data Structures and Data Management. Module 4: Dictionaries CS 24 Data Structures and Data Management Module 4: Dictionaries A. Biniaz A. Jamshidpey É. Schost Based on lecture notes by many previous cs24 instructors David R. Cheriton School of Computer Science,

More information

Arrow s Impossibility Theorem

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

More information

Probability. b a b. a b 32.

Probability. b a b. a b 32. Proility If n event n hppen in '' wys nd fil in '' wys, nd eh of these wys is eqully likely, then proility or the hne, or its hppening is, nd tht of its filing is eg, If in lottery there re prizes nd lnks,

More information

] dx (3) = [15x] 2 0

] dx (3) = [15x] 2 0 Leture 6. Double Integrls nd Volume on etngle Welome to Cl IV!!!! These notes re designed to be redble nd desribe the w I will eplin the mteril in lss. Hopefull the re thorough, but it s good ide to hve

More information

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

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

More information

NON-DETERMINISTIC FSA

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

More information

12.4 Similarity in Right Triangles

12.4 Similarity in Right Triangles Nme lss Dte 12.4 Similrit in Right Tringles Essentil Question: How does the ltitude to the hpotenuse of right tringle help ou use similr right tringles to solve prolems? Eplore Identifing Similrit in Right

More information

+ = () i =, find the values of x & y. 4. Write the function in the simplifies from. ()tan i. x x. 5. Find the derivative of. 6.

+ = () i =, find the values of x & y. 4. Write the function in the simplifies from. ()tan i. x x. 5. Find the derivative of. 6. Summer vtions Holid Home Work 7-8 Clss-XII Mths. Give the emple of reltion, whih is trnsitive ut neither refleive nor smmetri.. Find the vlues of unknown quntities if. + + () i =, find the vlues of & 7

More information

Fast index for approximate string matching

Fast index for approximate string matching Fst index for pproximte string mthing Dekel Tsur Astrt We present n index tht stores text of length n suh tht given pttern of length m, ll the sustrings of the text tht re within Hmming distne (or edit

More information

Tries and suffixes trees

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

More information

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

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

More information

Lecture 11 Binary Decision Diagrams (BDDs)

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

More information

GRAND PLAN. Visualizing Quaternions. I: Fundamentals of Quaternions. Andrew J. Hanson. II: Visualizing Quaternion Geometry. III: Quaternion Frames

GRAND PLAN. Visualizing Quaternions. I: Fundamentals of Quaternions. Andrew J. Hanson. II: Visualizing Quaternion Geometry. III: Quaternion Frames Visuliing Quternions Andrew J. Hnson Computer Siene Deprtment Indin Universit Siggrph Tutoril GRAND PLAN I: Fundmentls of Quternions II: Visuliing Quternion Geometr III: Quternion Frmes IV: Clifford Algers

More information

AP CALCULUS Test #6: Unit #6 Basic Integration and Applications

AP CALCULUS Test #6: Unit #6 Basic Integration and Applications AP CALCULUS Test #6: Unit #6 Bsi Integrtion nd Applitions A GRAPHING CALCULATOR IS REQUIRED FOR SOME PROBLEMS OR PARTS OF PROBLEMS IN THIS PART OF THE EXAMINATION. () The ext numeril vlue of the orret

More information

Lecture 6: Coding theory

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

More information

Non Right Angled Triangles

Non Right Angled Triangles Non Right ngled Tringles Non Right ngled Tringles urriulum Redy www.mthletis.om Non Right ngled Tringles NON RIGHT NGLED TRINGLES sin i, os i nd tn i re lso useful in non-right ngled tringles. This unit

More information

CS241 Week 6 Tutorial Solutions

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

More information

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

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

More information

Ch. 2.3 Counting Sample Points. Cardinality of a Set

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

More information

Data Structures (Classroom Practice Booklet Solutions)

Data Structures (Classroom Practice Booklet Solutions) Dt Strutures (Clssroom Prtie Booklet Solutions). Arrys. Ans: o of A [] = +(+) = Here, j is Vrying lo. of Ai, j i rows j C In (i ) rows no. of elements, + + +.+(i ) = i (i )/ lo of Ai, j [i(i ) / (j )]

More information

CSE : Exam 3-ANSWERS, Spring 2011 Time: 50 minutes

CSE : Exam 3-ANSWERS, Spring 2011 Time: 50 minutes CSE 260-002: Exm 3-ANSWERS, Spring 20 ime: 50 minutes Nme: his exm hs 4 pges nd 0 prolems totling 00 points. his exm is closed ook nd closed notes.. Wrshll s lgorithm for trnsitive closure computtion is

More information

First Midterm Examination

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

More information

Chapter 5 Plan-Space Planning

Chapter 5 Plan-Space Planning Lecture slides for Automted Plnning: Theory nd Prctice Chpter 5 Pln-Spce Plnning Dn S. Nu CMSC 722, AI Plnning University of Mrylnd, Spring 2008 1 Stte-Spce Plnning Motivtion g 1 1 g 4 4 s 0 g 5 5 g 2

More information

Intermediate Math Circles Wednesday 17 October 2012 Geometry II: Side Lengths

Intermediate Math Circles Wednesday 17 October 2012 Geometry II: Side Lengths Intermedite Mth Cirles Wednesdy 17 Otoer 01 Geometry II: Side Lengths Lst week we disussed vrious ngle properties. As we progressed through the evening, we proved mny results. This week, we will look t

More information

y z A left-handed system can be rotated to look like the following. z

y z A left-handed system can be rotated to look like the following. z Chpter 2 Crtesin Coördintes The djetive Crtesin bove refers to René Desrtes (1596 1650), who ws the first to oördintise the plne s ordered pirs of rel numbers, whih provided the first sstemti link between

More information

CSE 5311 Notes 2: Binary Search Trees

CSE 5311 Notes 2: Binary Search Trees S Notes : inry Serch Trees (Lst updted /0/7 0: M) ROTTIONS c d Single left rottion t (K rotting edge ) Single right rottion t (K rotting edge ) d c c d F oule right rottion t F G F G Wht two single rottions

More information

EE 330/330L Energy Systems (Spring 2012) Laboratory 1 Three-Phase Loads

EE 330/330L Energy Systems (Spring 2012) Laboratory 1 Three-Phase Loads ee330_spring2012_l_01_3phse_lods.do 1/5 EE 330/330L Energy Systems (Spring 2012) Lortory 1 ThreePhse Lods Introdution/Bkground In this lortory, you will mesure nd study the voltges, urrents, impednes,

More information

Discrete Structures Lecture 11

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

More information

DIRECT CURRENT CIRCUITS

DIRECT CURRENT CIRCUITS DRECT CURRENT CUTS ELECTRC POWER Consider the circuit shown in the Figure where bttery is connected to resistor R. A positive chrge dq will gin potentil energy s it moves from point to point b through

More information

m A 1 1 A ! and AC 6

m A 1 1 A ! and AC 6 REVIEW SET A Using sle of m represents units, sketh vetor to represent: NON-CALCULATOR n eroplne tking off t n ngle of 8 ± to runw with speed of 6 ms displement of m in north-esterl diretion. Simplif:

More information

(a) A partition P of [a, b] is a finite subset of [a, b] containing a and b. If Q is another partition and P Q, then Q is a refinement of P.

(a) A partition P of [a, b] is a finite subset of [a, b] containing a and b. If Q is another partition and P Q, then Q is a refinement of P. Chpter 7: The Riemnn Integrl When the derivtive is introdued, it is not hrd to see tht the it of the differene quotient should be equl to the slope of the tngent line, or when the horizontl xis is time

More information

CS 347 Parallel and Distributed Data Processing

CS 347 Parallel and Distributed Data Processing CS 347 Prllel nd Distriuted Dt Proessing Spring 06 Network Prtitions Susets of nodes m e isolted or nodes m e slow in responding Notes 8: Network Prtitions CS 347 Notes 8 Network Prtitions Cuses ired network

More information

Free groups, Lecture 2, part 1

Free groups, Lecture 2, part 1 Free groups, Lecture 2, prt 1 Olg Khrlmpovich NYC, Sep. 2 1 / 22 Theorem Every sugroup H F of free group F is free. Given finite numer of genertors of H we cn compute its sis. 2 / 22 Schreir s grph The

More information

CS 2204 DIGITAL LOGIC & STATE MACHINE DESIGN SPRING 2014

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

More information

H (2a, a) (u 2a) 2 (E) Show that u v 4a. Explain why this implies that u v 4a, with equality if and only u a if u v 2a.

H (2a, a) (u 2a) 2 (E) Show that u v 4a. Explain why this implies that u v 4a, with equality if and only u a if u v 2a. Chpter Review 89 IGURE ol hord GH of the prol 4. G u v H (, ) (A) Use the distne formul to show tht u. (B) Show tht G nd H lie on the line m, where m ( )/( ). (C) Solve m for nd sustitute in 4, otining

More information

Electronic Circuits I Revision after midterm

Electronic Circuits I Revision after midterm Eletroni Ciruits I Revision fter miterm Dr. Ahme ElShfee, ACU : Fll 2018, Eletroni Ciruits I -1 / 14 - MCQ1 # Question If the frequeny of the input voltge in Figure 2 36 is inrese, the output voltge will

More information

Solutions to Assignment 1

Solutions to Assignment 1 MTHE 237 Fll 2015 Solutions to Assignment 1 Problem 1 Find the order of the differentil eqution: t d3 y dt 3 +t2 y = os(t. Is the differentil eqution liner? Is the eqution homogeneous? b Repet the bove

More information

Section 2.3. Matrix Inverses

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

More information

Version 001 HW#6 - Electromagnetism arts (00224) 1

Version 001 HW#6 - Electromagnetism arts (00224) 1 Version 001 HW#6 - Electromgnetism rts (00224) 1 This print-out should hve 11 questions. Multiple-choice questions my continue on the next column or pge find ll choices efore nswering. rightest Light ul

More information

Factorising FACTORISING.

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

More information

T 1 T 2 T 3 T 4 They may be illustrated by triangular patterns of numbers (hence their name) as shown:

T 1 T 2 T 3 T 4 They may be illustrated by triangular patterns of numbers (hence their name) as shown: TOPIC 3: VISUAL EXPLANATIONS (PROOFS) (Pge references to Proof re to Bndll, P R et l, Proof in Mthemtics, KMEP, 2002). 3. The tringulr numbers form the sequence, 3, 6, 0,, 2,... T T 2 T 3 T 4 The m be

More information

In right-angled triangles the square on the side subtending the right angle is equal to the squares on the sides containing the right angle.

In right-angled triangles the square on the side subtending the right angle is equal to the squares on the sides containing the right angle. Mth 3329-Uniform Geometries Leture 06 1. Review of trigonometry While we re looking t Eulid s Elements, I d like to look t some si trigonometry. Figure 1. The Pythgoren theorem sttes tht if = 90, then

More information

50 AMC Lectures Problem Book 2 (36) Substitution Method

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

More information

April 8, 2017 Math 9. Geometry. Solving vector problems. Problem. Prove that if vectors and satisfy, then.

April 8, 2017 Math 9. Geometry. Solving vector problems. Problem. Prove that if vectors and satisfy, then. pril 8, 2017 Mth 9 Geometry Solving vetor prolems Prolem Prove tht if vetors nd stisfy, then Solution 1 onsider the vetor ddition prllelogrm shown in the Figure Sine its digonls hve equl length,, the prllelogrm

More information

Introduction to Olympiad Inequalities

Introduction to Olympiad Inequalities Introdution to Olympid Inequlities Edutionl Studies Progrm HSSP Msshusetts Institute of Tehnology Snj Simonovikj Spring 207 Contents Wrm up nd Am-Gm inequlity 2. Elementry inequlities......................

More information

Parse trees, ambiguity, and Chomsky normal form

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

More information

INTEGRATION. 1 Integrals of Complex Valued functions of a REAL variable

INTEGRATION. 1 Integrals of Complex Valued functions of a REAL variable INTEGRATION NOTE: These notes re supposed to supplement Chpter 4 of the online textbook. 1 Integrls of Complex Vlued funtions of REAL vrible If I is n intervl in R (for exmple I = [, b] or I = (, b)) nd

More information

The Double Integral. The Riemann sum of a function f (x; y) over this partition of [a; b] [c; d] is. f (r j ; t k ) x j y k

The Double Integral. The Riemann sum of a function f (x; y) over this partition of [a; b] [c; d] is. f (r j ; t k ) x j y k The Double Integrl De nition of the Integrl Iterted integrls re used primrily s tool for omputing double integrls, where double integrl is n integrl of f (; y) over region : In this setion, we de ne double

More information

Uses of transformations. 3D transformations. Review of vectors. Vectors in 3D. Points vs. vectors. Homogeneous coordinates S S [ H [ S \ H \ S ] H ]

Uses of transformations. 3D transformations. Review of vectors. Vectors in 3D. Points vs. vectors. Homogeneous coordinates S S [ H [ S \ H \ S ] H ] Uses of trnsformtions 3D trnsformtions Modeling: position nd resize prts of complex model; Viewing: define nd position the virtul cmer Animtion: define how objects move/chnge with time y y Sclr (dot) product

More information

IMPOSSIBLE NAVIGATION

IMPOSSIBLE NAVIGATION Sclrs versus Vectors IMPOSSIBLE NAVIGATION The need for mgnitude AND direction Sclr: A quntity tht hs mgnitude (numer with units) ut no direction. Vector: A quntity tht hs oth mgnitude (displcement) nd

More information

CS 188: Artificial Intelligence Spring 2007

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

More information

Linear Algebra Introduction

Linear Algebra Introduction Introdution Wht is Liner Alger out? Liner Alger is rnh of mthemtis whih emerged yers k nd ws one of the pioneer rnhes of mthemtis Though, initilly it strted with solving of the simple liner eqution x +

More information

Momentum and Energy Review

Momentum and Energy Review Momentum n Energy Review Nme: Dte: 1. A 0.0600-kilogrm ll trveling t 60.0 meters per seon hits onrete wll. Wht spee must 0.0100-kilogrm ullet hve in orer to hit the wll with the sme mgnitue of momentum

More information

Powering a number. More Divide & Conquer

Powering a number. More Divide & Conquer CS 4 -- Spring 29 Powering numer Prolem: Compute n, where n N. Nive lgorithm: Θ(n). ore Divide & Conquer Crol Wenk Slides ourtesy of Chrles Leiserson with smll hnges y Crol Wenk 2//9 CS 4 nlysis of lgorithms

More information

Part 4. Integration (with Proofs)

Part 4. Integration (with Proofs) Prt 4. Integrtion (with Proofs) 4.1 Definition Definition A prtition P of [, b] is finite set of points {x 0, x 1,..., x n } with = x 0 < x 1

More information