Applications of trees

Similar documents
Theorem 1. An undirected graph is a tree if and only if there is a unique simple path between any two of its vertices.

CMPS 2200 Fall Graphs. Carola Wenk. Slides courtesy of Charles Leiserson with changes and additions by Carola Wenk

Graphs Depth First Search

Lecture 20: Minimum Spanning Trees (CLRS 23)

COMP 250. Lecture 29. graph traversal. Nov. 15/16, 2017

Weighted Graphs. Weighted graphs may be either directed or undirected.

Strongly connected components. Finding strongly-connected components

Planar convex hulls (I)

(Minimum) Spanning Trees

Graphs Breadth First Search

Spanning Trees. BFS, DFS spanning tree Minimum spanning tree. March 28, 2018 Cinda Heeren / Geoffrey Tien 1

Improving Union. Implementation. Union-by-size Code. Union-by-Size Find Analysis. Path Compression! Improving Find find(e)

The University of Sydney MATH 2009

5/1/2018. Huffman Coding Trees. Huffman Coding Trees. Huffman Coding Trees. Huffman Coding Trees. Huffman Coding Trees. Huffman Coding Trees

Depth First Search. Yufei Tao. Department of Computer Science and Engineering Chinese University of Hong Kong

On Hamiltonian Tetrahedralizations Of Convex Polyhedra

Graph Search (6A) Young Won Lim 5/18/18

CMSC 451: Lecture 4 Bridges and 2-Edge Connectivity Thursday, Sep 7, 2017

4.1 Interval Scheduling. Chapter 4. Greedy Algorithms. Interval Scheduling: Greedy Algorithms. Interval Scheduling. Interval scheduling.

Graph Search Algorithms

Minimum Spanning Trees (CLRS 23)

Divided. diamonds. Mimic the look of facets in a bracelet that s deceptively deep RIGHT-ANGLE WEAVE. designed by Peggy Brinkman Matteliano

SAMPLE CSc 340 EXAM QUESTIONS WITH SOLUTIONS: part 2

Priority Search Trees - Part I

Closed Monochromatic Bishops Tours

Computer Graphics. Viewing & Projections

Minimum Spanning Trees (CLRS 23)

CSE 332. Data Structures and Parallelism

CSE 332. Graphs 1: What is a Graph? DFS and BFS. Data Abstractions. CSE 332: Data Abstractions. A Graph is a Thingy... 2

Lecture II: Minimium Spanning Tree Algorithms

CS61B Lecture #33. Administrivia: Autograder will run this evening. Today s Readings: Graph Structures: DSIJ, Chapter 12

In which direction do compass needles always align? Why?

CS 103 BFS Alorithm. Mark Redekopp

A ' / 1 6 " 5 ' / 4 " A4.2 48' - 0" 3 12' - 7" 13' - 11" 10' - 0" 9' - 0" 2' - 6" 1. 2: 12 INDICATES SHOW MELT TYP ABV ABV

T H E S C I E N C E B E H I N D T H E A R T

Having a glimpse of some of the possibilities for solutions of linear systems, we move to methods of finding these solutions. The basic idea we shall

learning objectives learn what graphs are in mathematical terms learn how to represent graphs in computers learn about typical graph algorithms

CSE 332. Graphs 1: What is a Graph? DFS and BFS. Data Abstractions. CSE 332: Data Abstractions. A Graph is a Thingy... 2

L.3922 M.C. L.3922 M.C. L.2996 M.C. L.3909 M.C. L.5632 M.C. L M.C. L.5632 M.C. L M.C. DRIVE STAR NORTH STAR NORTH NORTH DRIVE

CHELOURANYAN CALENDAR FOR YEAR 3335 YEAR OF SAI RHAVË

Differentiation of allergenic fungal spores by image analysis, with application to aerobiological counts

CSE 373: More on graphs; DFS and BFS. Michael Lee Wednesday, Feb 14, 2018

2 Trees and Their Applications

CHARACTERIZATION FROM EXPONENTIATED GAMMA DISTRIBUTION BASED ON RECORD VALUES

Platform Controls. 1-1 Joystick Controllers. Boom Up/Down Controller Adjustments

Verification of DAG Structures in Cooperative Belief Network Based Multi-agent Systems

The R-Tree. Yufei Tao. ITEE University of Queensland. INFS4205/7205, Uni of Queensland

16.unified Introduction to Computers and Programming. SOLUTIONS to Examination 4/30/04 9:05am - 10:00am

Paths. Connectivity. Euler and Hamilton Paths. Planar graphs.

Minimum Spanning Trees


Sheet Title: Building Renderings M. AS SHOWN Status: A.R.H.P.B. SUBMITTAL August 9, :07 pm

V={A,B,C,D,E} E={ (A,D),(A,E),(B,D), (B,E),(C,D),(C,E)}

Winnie flies again. Winnie s Song. hat. A big tall hat Ten long toes A black magic wand A long red nose. nose. She s Winnie Winnie the Witch.

Math 166 Week in Review 2 Sections 1.1b, 1.2, 1.3, & 1.4

DOCUMENT STATUS: RELEASE

PR D NT N n TR T F R 6 pr l 8 Th Pr d nt Th h t H h n t n, D D r r. Pr d nt: n J n r f th r d t r v th tr t d rn z t n pr r f th n t d t t. n

A L A BA M A L A W R E V IE W

Bayesian belief networks: Inference

V={A,B,C,D,E} E={ (A,D),(A,E),(B,D), (B,E),(C,D),(C,E)}

Shortest Paths in Graphs. Paths in graphs. Shortest paths CS 445. Alon Efrat Slides courtesy of Erik Demaine and Carola Wenk

I M P O R T A N T S A F E T Y I N S T R U C T I O N S W h e n u s i n g t h i s e l e c t r o n i c d e v i c e, b a s i c p r e c a u t i o n s s h o

Graph Search Algorithms CSE

Face Detection and Recognition. Linear Algebra and Face Recognition. Face Recognition. Face Recognition. Dimension reduction

5/7/13. Part 10. Graphs. Theorem Theorem Graphs Describing Precedence. Outline. Theorem 10-1: The Handshaking Theorem

Designing A Uniformly Loaded Arch Or Cable

Determination of slot leakage inductance for three-phase induction motor winding using an analytical method

An undirected graph G = (V, E) V a set of vertices E a set of unordered edges (v,w) where v, w in V

23 Minimum Spanning Trees

17 Basic Graph Properties

Humanistic, and Particularly Classical, Studies as a Preparation for the Law

10. EXTENDING TRACTABILITY

n r t d n :4 T P bl D n, l d t z d th tr t. r pd l

Cycles and Simple Cycles. Paths and Simple Paths. Trees. Problem: There is No Completely Standard Terminology!

176 5 t h Fl oo r. 337 P o ly me r Ma te ri al s

/99 $10.00 (c) 1999 IEEE

4 4 N v b r t, 20 xpr n f th ll f th p p l t n p pr d. H ndr d nd th nd f t v L th n n f th pr v n f V ln, r dn nd l r thr n nt pr n, h r th ff r d nd

828.^ 2 F r, Br n, nd t h. n, v n lth h th n l nd h d n r d t n v l l n th f v r x t p th l ft. n ll n n n f lt ll th t p n nt r f d pp nt nt nd, th t

F102 1/4 AMP +240 VDC SEE FIGURE 5-14 FILAMENT AND OVEN CKTS BLU J811 BREAK-IN TB103 TO S103 TRANSMITTER ASSOCIATED CAL OFF FUNCTION NOTE 2 STANDBY

CLKOUT CLKOUT VCC CLKOUT RESOUT OSCOUT ALE TEST AD0 66 AD2 INT0 INT0 AD INT1 AD INT2/INTA0 AD5 AD7 AD7 INT AD8 AD8 AD10

Housing Market Monitor

12/3/12. Outline. Part 10. Graphs. Circuits. Euler paths/circuits. Euler s bridge problem (Bridges of Konigsberg Problem)

,. *â â > V>V. â ND * 828.

5/9/13. Part 10. Graphs. Outline. Circuits. Introduction Terminology Implementing Graphs

I N A C O M P L E X W O R L D

MATERIAL SEE BOM ANGLES = 2 > 2000 DATE MEDIUM FINISH

DOCUMENT STATUS: MINTP0 E-ST5080, BASE, NO DISPLAY VENDOR: 15.5 INCH MATERIAL SEE BOM FINISH REVISION HISTORY ITEM NO. PART NUMBER DESCRIPTION

22 t b r 2, 20 h r, th xp t d bl n nd t fr th b rd r t t. f r r z r t l n l th h r t rl T l t n b rd n n l h d, nd n nh rd f pp t t f r n. H v v d n f

CS 461, Lecture 17. Today s Outline. Example Run

23 Minimum Spanning Trees

Exhibit 2-9/30/15 Invoice Filing Page 1841 of Page 3660 Docket No

Executive Committee and Officers ( )

Grade 7/8 Math Circles March 4/5, Graph Theory I- Solutions

N V R T F L F RN P BL T N B ll t n f th D p rt nt f l V l., N., pp NDR. L N, d t r T N P F F L T RTL FR R N. B. P. H. Th t t d n t r n h r d r

ELECTRONIC SUPPLEMENTARY INFORMATION

Problem 1. Solution: = show that for a constant number of particles: c and V. a) Using the definitions of P

CSC Design and Analysis of Algorithms. Example: Change-Making Problem

0 t b r 6, 20 t l nf r nt f th l t th t v t f th th lv, ntr t n t th l l l nd d p rt nt th t f ttr t n th p nt t th r f l nd d tr b t n. R v n n th r

Solutions for HW11. Exercise 34. (a) Use the recurrence relation t(g) = t(g e) + t(g/e) to count the number of spanning trees of v 1

b.) v d =? Example 2 l = 50 m, D = 1.0 mm, E = 6 V, " = 1.72 #10 $8 % & m, and r = 0.5 % a.) R =? c.) V ab =? a.) R eq =?

Transcription:

Trs Apptons o trs Orgnzton rts Attk trs to syst Anyss o tr ntworks Prsng xprssons Trs (rtrv o norton) Don-n strutur Mutstng Dstnton-s orwrng Trnsprnt swts Forwrng ts o prxs t routrs Struturs or nt pntton o gorts su s ps n oton o sont sts 1

Trs Connt n y grp T = (V, E) Equvnt rtrztons ny two vrts n T r onnt y unqu pt T s onnt n E = V - 1 T s y n E = V - 1 n g s rov ro E, tn t rsutng grp s sonnt n g s to E, tn t rsutng grp ontns y Any tr s t st two vrts o gr on Tr: ny two vrts r onnt y unqu pt I T s tr, tn vry pr o vrts u n v r onnt y unqu pt. Proo: Suppos tt u n v r onnt y two pts. Lt x t rst vrtx wr t two pts urt n y t rst vrtx tr x wr ty rg gn. Tn, tr s y nvovng x n y. I vry pr o vrts u n v s r onnt y unqu pt, tn T s tr. Proo: T s onnt. Suppos T s y. Any two nos o t y v two stnt pts twn t.

Root trs Tr wt sp vrtx r root v s t ngor o u n t unqu u-r pt v s prnt o u; u s o v v s n t unqu u-r pt v s n nstor o u; u s snnt o v Vrtx wtout rn s Lngt o t u-r pt s t v o u Hgst v s t pt o t tr A onnt oponnt t tr rov o t root wt o t root s sp vrtx s root tr 3 4 6 5 1 1 5 7 3 4 6 8 9 7 8 9 Bnry trs Root tr su tt vrtx s xu o two rn rn r stngus y ng tr t or rgt T trs root t t t n rgt o t root r nry trs 3

Fu nry tr nur n o vrts t v o nry tr stss t rurrn n 0 = 1 n n -1 or = 0, 1,, pt o t tr n nur o vrts n t tr n tr s u t v n = tr s u t s u t vry v n u tr n = 1 + + + = +1 1; = og (n + 1) 1 = og n Copt nry tr or nry tr t nos rursvy root s 0 t t o no s + 1; rgt s + tr wt n nos s opt t onssts o nos 0, 1,,, n 1 0 pt o opt nry tr s og n pt o nry tr s nvr ss tn og n u tr s opt tr wt +1 1 vrts 1 3 4 5 6 7 8 9 4

-trs tr s -tr vry vrtx tt s not s xty two rn Trvrs o nry trs prorr trvrs o t nry tr vst t root no prorr trvrs o t t sutr prorr trvrs o t rgt sutr norr trvrs o t nry tr norr trvrs o t t sutr vst t root no norr trvrs o t rgt sutr postorr trvrs o t nry tr postorr trvrs o t t sutr postorr trvrs o t rgt sutr vst t root no 5

Exps g prorr: g norr: g postorr: g Prorr: rursv o Prorr(root) root nu tn Vst(root -> no) Prorr(root -> tc) Prorr(root -> rgtc) n Prorr(root) Vst(root -> no) root -> tc nu tn Prorr(root -> tc) n root -> rgtc nu tn Prorr(root -> rgtc) n In Prorr pt o t trvrs s ru y on n rton to Prorr 6

Bnry sr trs strutur to ntn n orr st o ts Bnry tr Evry ky n t t su-tr o t root s sr tn t ky n t root Evry ky n t rgt su-tr o t root s rgr tn t ky n t root Bot t n rgt su-trs r nry sr trs n r oo gu Proposton: gvn nry tr wt n nos n n orr kys tr s unqu ssgnnt o kys to t nos tt k or nry sr ky Oprtons on nry sr kys Srng ky, SrBnSrTr Insrtng ky, InsrtBnSrTr Dtng ky, DtBnSrTr Assng t kys n sort orr (In-orr trvrs o t nry sr tr) 7

Srng ky SrBnSrTr(root, X, oton, oun) oun := s oton := nu urrnt := root w urrnt nu n not oun o oton := urrnt X = urrnt -> ky tn oun := tru s X < urrnt -> ky tn urrnt := urrnt -> tc s urrnt := urrnt -> rgtc n nw Insrtng ky nsrtbnsrtr(root, X) root = nu tn otbntrno(noptr) noptr -> ky := X root := noptr s SrBnSrTr(root, X, oton, oun) not oun tn otbntrno(noptr) noptr -> ky := X X < oton > ky tn oton -> tc := noptr s oton -> rgtc := noptr n n n 8

9 Dtng ky: no g k g ton o k Dtng ky: ntrn sng- no g k g k ton o

Dtng ky: no wt two rn opy o n-orr sussor ton o n-orr sussor g k k k n orr sussor o X s t sst ky grtr tn X Dtng ky: o DtBnSrTr(root, no) no -> tc nu n no -> rgtc nu sussor := no -> rgtc w sussor -> tc nu sussor := sussor -> tc nw no > ky := sussor -> ky no := sussor prnt := no -> prnt n // Now no ponts to t no wt xu // o on to t //ontnuton no -> tc nu tn ppropc := no -> tc s ppropc := no -> rgtc n prnt = nu tn root := ppropc s prnt -> tc = no tn prnt -> tc := ppropc s prnt -> rgtc := ppropc n 10

Prorty quu Coton o nts, o w s prorty vu Oprtons on prorty quu ton o t nt o gst prorty nsrton o n nt Ipntton s n orr st ton s worst-s opxty O(1) nsrton s worst-s opxty O(n) Ipntton s n unorr st ton s worst-s opxty O(n) nsrton s worst-s opxty O(1) (Mn-)Hp Copt nry tr T vu o vry no s not rgr tn t vu o ts t n t vu o ts rgt t o no o nx s nx +1 rgt o no o nx s nx + or > 0, prnt o no o nx s nx ( 1)/ 38 3 0 90 47 40 3 nx 0 1 3 4 5 6 7 8 9 vu 38 3 0 90 47 40 3 11

Insrtng vu nsrt 1 38 3 0 90 38 3 0 90 47 40 3 47 40 3 1 1 38 1 0 90 38 0 90 47 40 3 3 47 40 3 3 Insrtng vu: o InsrtMnHp(A[], psz, x) := psz := ( 1)/ w 0 n A[] > x A[] := A[] := := ( 1)/ nw A[] := x psz := psz + 1 worst-s opxty s O(og n) 1

Dtng t nu vu ton 3 38 3 0 90 38 3 0 90 47 40 3 47 40 3 0 38 3 0 90 38 3 3 90 47 40 47 40 Dtng t nu vu: o RovMnHp(A[], psz) x := A[0] psz := psz 1 tp := A[pSz] oun := s := 1 w psz 1 n not oun < psz - 1 n A[] > A[ + 1] tn := + 1 n tp A[] tn oun := tru worst-s opxty s O(og n) s A[ ( 1)/ ] := A[] := * + 1 n nw A[ ( 1)/ ] := tp rturn x 13

Stnr Trs Coton o strngs ro nt pt no strng s prx o ny otr strng Root tr s r ttrs ro t pt strngs orrspon xty to pts ro root to vs g o r t y n n t r t v w w o r Coprss Trs (PATRICIA) oprss pts n stnr Tr ntr w gort n vw or y t 14